diff options
-rw-r--r-- | fs/fs.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -145,6 +145,7 @@ char *normalise_path(const char *pathname) 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 @@ static char *__canonicalize_path(const char *_pathname, int level) char *p = strsep(&path, "/"); char *tmp; char link[PATH_MAX] = {}; + struct fs_device_d *fsdev; if (!p) break; @@ -185,6 +187,14 @@ static char *__canonicalize_path(const char *_pathname, int level) 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; |