Re: [PATCH v2 02/16] fsnotify: factor helpers fsnotify_dentry() and fsnotify_file()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon 17-02-20 15:14:41, Amir Goldstein wrote:
> Most of the code in fsnotify hooks is boiler plate of one or the other.
> 
> Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx>
> ---
>  include/linux/fsnotify.h | 96 +++++++++++++++-------------------------
>  1 file changed, 36 insertions(+), 60 deletions(-)

Nice cleanup. Just two comments below.

> @@ -58,8 +78,6 @@ static inline int fsnotify_path(struct inode *inode, const struct path *path,
>  static inline int fsnotify_perm(struct file *file, int mask)
>  {
>  	int ret;
> -	const struct path *path = &file->f_path;
> -	struct inode *inode = file_inode(file);
>  	__u32 fsnotify_mask = 0;
>  
>  	if (file->f_mode & FMODE_NONOTIFY)

I guess you can drop the NONOTIFY check from here. You've moved it to
fsnotify_file() and there's not much done in this function to be worth
skipping...

> @@ -70,7 +88,7 @@ static inline int fsnotify_perm(struct file *file, int mask)
>  		fsnotify_mask = FS_OPEN_PERM;
>  
>  		if (file->f_flags & __FMODE_EXEC) {
> -			ret = fsnotify_path(inode, path, FS_OPEN_EXEC_PERM);
> +			ret = fsnotify_file(file, FS_OPEN_EXEC_PERM);
>  
>  			if (ret)
>  				return ret;

Hum, I think we could simplify fsnotify_perm() even further by having:

	if (mask & MAY_OPEN) {
		if (file->f_flags & __FMODE_EXEC)
			fsnotify_mask = FS_OPEN_EXEC_PERM;
		else
			fsnotify_mask = FS_OPEN_PERM;
	} ...

Otherwise the patch looks good to me.

								Honza
-- 
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux