[Devel] [PATCH rh7] fsnotify: Make fdinfo to always success
Cyrill Gorcunov
gorcunov at virtuozzo.com
Tue Oct 20 12:13:45 PDT 2015
There is a diet backport of vanillas
ML: a3816ab0e8fe542a89a53b82506a8ddac063fbe3
which allows to disaply a large numbers of inotify assigned.
Otherwise only ones fit to 4K buffer would be shown.
https://jira.sw.ru/browse/PSBM-40337
Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
CC: Konstantin Khorenko <khorenko at virtuozzo.com>
---
fs/notify/fdinfo.c | 52 ++++++++++++++++++++++------------------------------
1 file changed, 22 insertions(+), 30 deletions(-)
Index: linux-pcs7.git/fs/notify/fdinfo.c
===================================================================
--- linux-pcs7.git.orig/fs/notify/fdinfo.c
+++ linux-pcs7.git/fs/notify/fdinfo.c
@@ -25,16 +25,15 @@ static int show_fdinfo(struct seq_file *
{
struct fsnotify_group *group = f->private_data;
struct fsnotify_mark *mark;
- int ret = 0;
mutex_lock(&group->mark_mutex);
list_for_each_entry(mark, &group->marks_list, g_list) {
- ret = show(m, mark);
- if (ret)
+ show(m, mark);
+ if (m->count == m->size)
break;
}
mutex_unlock(&group->mark_mutex);
- return ret;
+ return 0;
}
#if defined(CONFIG_EXPORTFS)
@@ -58,13 +57,13 @@ static int show_mark_fhandle(struct seq_
f.handle.handle_type = ret;
f.handle.handle_bytes = size * sizeof(u32);
- ret = seq_printf(m, "fhandle-bytes:%x fhandle-type:%x f_handle:",
- f.handle.handle_bytes, f.handle.handle_type);
+ seq_printf(m, "fhandle-bytes:%x fhandle-type:%x f_handle:",
+ f.handle.handle_bytes, f.handle.handle_type);
for (i = 0; i < f.handle.handle_bytes; i++)
- ret |= seq_printf(m, "%02x", (int)f.handle.f_handle[i]);
+ seq_printf(m, "%02x", (int)f.handle.f_handle[i]);
- return ret;
+ return 0;
}
#else
static int show_mark_fhandle(struct seq_file *m, struct inode *inode)
@@ -79,7 +78,6 @@ static int inotify_fdinfo(struct seq_fil
{
struct inotify_inode_mark *inode_mark;
struct inode *inode;
- int ret = 0;
if (!(mark->flags & (FSNOTIFY_MARK_FLAG_ALIVE | FSNOTIFY_MARK_FLAG_INODE)))
return 0;
@@ -87,17 +85,15 @@ static int inotify_fdinfo(struct seq_fil
inode_mark = container_of(mark, struct inotify_inode_mark, fsn_mark);
inode = igrab(mark->i.inode);
if (inode) {
- ret = seq_printf(m, "inotify wd:%x ino:%lx sdev:%x "
- "mask:%x ignored_mask:%x ",
- inode_mark->wd, inode->i_ino,
- inode->i_sb->s_dev,
- mark->mask, mark->ignored_mask);
- ret |= show_mark_fhandle(m, inode);
- ret |= seq_putc(m, '\n');
+ seq_printf(m, "inotify wd:%x ino:%lx sdev:%x mask:%x ignored_mask:%x ",
+ inode_mark->wd, inode->i_ino, inode->i_sb->s_dev,
+ mark->mask, mark->ignored_mask);
+ show_mark_fhandle(m, inode);
+ seq_putc(m, '\n');
iput(inode);
}
- return ret;
+ return 0;
}
int inotify_show_fdinfo(struct seq_file *m, struct file *f)
@@ -113,7 +109,6 @@ static int fanotify_fdinfo(struct seq_fi
{
unsigned int mflags = 0;
struct inode *inode;
- int ret = 0;
if (!(mark->flags & FSNOTIFY_MARK_FLAG_ALIVE))
return 0;
@@ -124,23 +119,20 @@ static int fanotify_fdinfo(struct seq_fi
if (mark->flags & FSNOTIFY_MARK_FLAG_INODE) {
inode = igrab(mark->i.inode);
if (!inode)
- goto out;
- ret = seq_printf(m, "fanotify ino:%lx sdev:%x "
- "mflags:%x mask:%x ignored_mask:%x ",
- inode->i_ino, inode->i_sb->s_dev,
- mflags, mark->mask, mark->ignored_mask);
- ret |= show_mark_fhandle(m, inode);
- ret |= seq_putc(m, '\n');
+ return 0;
+ seq_printf(m, "fanotify ino:%lx sdev:%x mflags:%x mask:%x ignored_mask:%x ",
+ inode->i_ino, inode->i_sb->s_dev,
+ mflags, mark->mask, mark->ignored_mask);
+ show_mark_fhandle(m, inode);
+ seq_putc(m, '\n');
iput(inode);
} else if (mark->flags & FSNOTIFY_MARK_FLAG_VFSMOUNT) {
struct mount *mnt = real_mount(mark->m.mnt);
- ret = seq_printf(m, "fanotify mnt_id:%x mflags:%x mask:%x "
- "ignored_mask:%x\n", mnt->mnt_id, mflags,
- mark->mask, mark->ignored_mask);
+ seq_printf(m, "fanotify mnt_id:%x mflags:%x mask:%x ignored_mask:%x\n",
+ mnt->mnt_id, mflags, mark->mask, mark->ignored_mask);
}
-out:
- return ret;
+ return 0;
}
int fanotify_show_fdinfo(struct seq_file *m, struct file *f)
More information about the Devel
mailing list