Commit 380cb5d3 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'fsnotify_for_v6.18-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs

Pull fsnotify fixes from Jan Kara:

 - Stop-gap solution for a race between unmount of a filesystem with
   fsnotify marks and someone inspecting fdinfo of fsnotify group with
   those marks in procfs.

   A proper solution is in the works but it will get a while to settle.

 - Fix for non-decodable file handles (used by unprivileged apps using
   fanotify)

* tag 'fsnotify_for_v6.18-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
  fs/notify: call exportfs_encode_fid with s_umount
  expfs: Fix exportfs_can_encode_fh() for EXPORT_FH_FID
parents 211ddde0 a7c4bb43
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#include "fanotify/fanotify.h"
#include "fdinfo.h"
#include "fsnotify.h"
#include "../internal.h"

#if defined(CONFIG_PROC_FS)

@@ -46,7 +47,12 @@ static void show_mark_fhandle(struct seq_file *m, struct inode *inode)

	size = f->handle_bytes >> 2;

	if (!super_trylock_shared(inode->i_sb))
		return;

	ret = exportfs_encode_fid(inode, (struct fid *)f->f_handle, &size);
	up_read(&inode->i_sb->s_umount);

	if ((ret == FILEID_INVALID) || (ret < 0))
		return;

+4 −3
Original line number Diff line number Diff line
@@ -320,9 +320,6 @@ static inline bool exportfs_can_decode_fh(const struct export_operations *nop)
static inline bool exportfs_can_encode_fh(const struct export_operations *nop,
					  int fh_flags)
{
	if (!nop)
		return false;

	/*
	 * If a non-decodeable file handle was requested, we only need to make
	 * sure that filesystem did not opt-out of encoding fid.
@@ -330,6 +327,10 @@ static inline bool exportfs_can_encode_fh(const struct export_operations *nop,
	if (fh_flags & EXPORT_FH_FID)
		return exportfs_can_encode_fid(nop);

	/* Normal file handles cannot be created without export ops */
	if (!nop)
		return false;

	/*
	 * If a connectable file handle was requested, we need to make sure that
	 * filesystem can also decode connected file handles.