Commit 997c6dd4 authored by Pavel Emelyanov's avatar Pavel Emelyanov

fsnotify: Don't scan irmap for tempfs

On this fs path can be resolved via proc, so even if
we're asked to do force-irmap, try to go via regular
resolve anyway.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 909c5d7f
...@@ -135,9 +135,6 @@ int check_open_handle(unsigned int s_dev, unsigned long i_ino, ...@@ -135,9 +135,6 @@ int check_open_handle(unsigned int s_dev, unsigned long i_ino,
int fd = -1; int fd = -1;
char *path; char *path;
if (opts.force_irmap)
goto do_irmap;
fd = open_handle(s_dev, i_ino, f_handle); fd = open_handle(s_dev, i_ino, f_handle);
if (fd >= 0) { if (fd >= 0) {
struct mount_info *mi; struct mount_info *mi;
...@@ -154,35 +151,44 @@ int check_open_handle(unsigned int s_dev, unsigned long i_ino, ...@@ -154,35 +151,44 @@ int check_open_handle(unsigned int s_dev, unsigned long i_ino,
* Inode numbers are not restored for tmpfs content, but we can * Inode numbers are not restored for tmpfs content, but we can
* get file names, becasue tmpfs cache is not pruned. * get file names, becasue tmpfs cache is not pruned.
*/ */
if (mi->fstype->code == FSTYPE__TMPFS) { if ((mi->fstype->code == FSTYPE__TMPFS) ||
(mi->fstype->code == FSTYPE__DEVTMPFS)) {
char p[PATH_MAX]; char p[PATH_MAX];
if (read_fd_link(fd, p, sizeof(p)) < 0) if (read_fd_link(fd, p, sizeof(p)) < 0)
goto err; goto err;
close_safe(&fd);
path = xstrdup(p); path = xstrdup(p);
if (path == NULL) if (path == NULL)
return -1; goto err;
goto out; goto out;
} }
close(fd); if (!opts.force_irmap)
return 0; /*
* If we're not forced to do irmap, then
* say we have no path for watch. Otherwise
* do irmap scan even if the handle is
* working.
*
* FIXME -- no need to open-by-handle if
* we are in force-irmap and not on tempfs
*/
goto out_nopath;
} }
do_irmap:
pr_warn("\tHandle %x:%lx cannot be opened\n", s_dev, i_ino); pr_warn("\tHandle %x:%lx cannot be opened\n", s_dev, i_ino);
path = irmap_lookup(s_dev, i_ino); path = irmap_lookup(s_dev, i_ino);
if (!path) { if (!path) {
pr_err("\tCan't dump that handle\n"); pr_err("\tCan't dump that handle\n");
return -1; return -1;
} }
out: out:
pr_debug("\tDumping %s as path for handle\n", path); pr_debug("\tDumping %s as path for handle\n", path);
f_handle->path = path; f_handle->path = path;
out_nopath:
close_safe(&fd);
return 0; return 0;
err: err:
close_safe(&fd); close_safe(&fd);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment