diff --git a/fs/fs.c b/fs/fs.c index a5efdd1..f61ee09 100644 --- a/fs/fs.c +++ b/fs/fs.c @@ -145,6 +145,7 @@ EXPORT_SYMBOL(normalise_path); static int __lstat(const char *filename, struct stat *s); +static struct fs_device_d *get_fsdevice_by_path(const char *path); static char *__canonicalize_path(const char *_pathname, int level) { @@ -167,6 +168,7 @@ char *p = strsep(&path, "/"); char *tmp; char link[PATH_MAX] = {}; + struct fs_device_d *fsdev; if (!p) break; @@ -185,6 +187,14 @@ free(outpath); outpath = tmp; + /* + * Don't bother filesystems without link support + * with an additional stat() call. + */ + fsdev = get_fsdevice_by_path(outpath); + if (!fsdev->driver->readlink) + continue; + ret = __lstat(outpath, &s); if (ret) goto out;