[PATCH] fsnotify: Do not show file handles for unsupported filesystems

From: Jan Kara
Date: Tue Dec 19 2017 - 07:38:54 EST


Filesystems not setting their s_export_op do not support file handles.
Do no try to encode them using exportfs_encode_inode_fh() since that may
fail or return garbage.

Reported-by: NeilBrown <neilb@xxxxxxxx>
Signed-off-by: Jan Kara <jack@xxxxxxx>
---
fs/notify/fdinfo.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/fs/notify/fdinfo.c b/fs/notify/fdinfo.c
index d478629c728b..041c2b0cc145 100644
--- a/fs/notify/fdinfo.c
+++ b/fs/notify/fdinfo.c
@@ -46,6 +46,9 @@ static void show_mark_fhandle(struct seq_file *m, struct inode *inode)
} f;
int size, ret, i;

+ if (!inode->i_sb->s_export_op)
+ return;
+
f.handle.handle_bytes = sizeof(f.pad);
size = f.handle.handle_bytes >> 2;

--
2.12.3


--J/dobhs11T7y2rNN--