Re: [PATCH 22/26] sys_mknodat(): elevate write count for vfs_mknod/create()

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

 



On Fri, Jun 22, 2007 at 01:03:32PM -0700, Dave Hansen wrote:
> 
> 
> This takes care of all of the direct callers of vfs_mknod().
> Since a few of these cases also handle normal file creation
> as well, this also covers some calls to vfs_create().

Ok.

> diff -puN fs/namei.c~18-24-sys-mknodat-elevate-write-count-for-vfs-mknod-create fs/namei.c
> --- lxc/fs/namei.c~18-24-sys-mknodat-elevate-write-count-for-vfs-mknod-create	2007-06-21 23:23:25.000000000 -0700
> +++ lxc-dave/fs/namei.c	2007-06-21 23:23:25.000000000 -0700
> @@ -1897,14 +1897,26 @@ asmlinkage long sys_mknodat(int dfd, con
>  	if (!IS_ERR(dentry)) {
>  		switch (mode & S_IFMT) {
>  		case 0: case S_IFREG:
> +			error = mnt_want_write(nd.mnt);
> +			if (error)
> +				break;
>  			error = vfs_create(nd.dentry->d_inode,dentry,mode,&nd);
> +			mnt_drop_write(nd.mnt);
>  			break;
>  		case S_IFCHR: case S_IFBLK:
> +			error = mnt_want_write(nd.mnt);
> +			if (error)
> +				break;
>  			error = vfs_mknod(nd.dentry->d_inode,dentry,mode,
>  					new_decode_dev(dev));
> +			mnt_drop_write(nd.mnt);
>  			break;
>  		case S_IFIFO: case S_IFSOCK:
> +			error = mnt_want_write(nd.mnt);
> +			if (error)
> +				break;
>  			error = vfs_mknod(nd.dentry->d_inode,dentry,mode,0);
> +			mnt_drop_write(nd.mnt);
>  			break;
>  		case S_IFDIR:
>  			error = -EPERM;

Should we just take the calls outside the switch statement?

-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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