]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
fs: send fsnotify_xattr()/IN_ATTRIB from vfs_fileattr_set()/chattr(1)
authorAhelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Mon, 8 Dec 2025 22:20:24 +0000 (23:20 +0100)
committerJan Kara <jack@suse.cz>
Mon, 15 Dec 2025 09:19:52 +0000 (10:19 +0100)
Currently it seems impossible to observe these changes to the file's
attributes. It's useful to be able to do this to see when the file
becomes immutable, for example, so emit IN_ATTRIB via fsnotify_xattr(),
like when changing other inode attributes.

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Link: https://patch.msgid.link/iyvn6qjotpu6cei5jdtsoibfcp6l6rgvn47cwgaucgtucpfy2s@tarta.nabijaczleweli.xyz
Signed-off-by: Jan Kara <jack@suse.cz>
fs/file_attr.c

index 1dcec88c0680506162ecb5ba540dbea3dc318f63..fac41048f7bc890b614a5c1a8622424c52bc58e1 100644 (file)
@@ -2,6 +2,7 @@
 #include <linux/fs.h>
 #include <linux/security.h>
 #include <linux/fscrypt.h>
+#include <linux/fsnotify.h>
 #include <linux/fileattr.h>
 #include <linux/export.h>
 #include <linux/syscalls.h>
@@ -298,6 +299,7 @@ int vfs_fileattr_set(struct mnt_idmap *idmap, struct dentry *dentry,
                err = inode->i_op->fileattr_set(idmap, dentry, fa);
                if (err)
                        goto out;
+               fsnotify_xattr(dentry);
        }
 
 out: