[PATCH] vfs_crossrename, zfs chmod can safely fail with aclmode=restrict

Jeremy Allison jra at samba.org
Fri Jun 27 18:05:33 MDT 2014


On Tue, Jun 24, 2014 at 12:54:27AM +0200, CurlyMo wrote:
> When a user runs a ZFS filesystem with aclmode=restrict, then all
> chmod operations will be restricted by ZFS and fail with "Operation
> not permitted". In the vfs crossrename module, a move will fail when
> the chmod operation returns an error and will therefor lead to
> undefined behavior on a ZFS filesystem with aclmode=restrict.
> 
> This patch alters the chmod condition to only return a failed move
> when the errno is anything other than EPERM. This was already done
> in the chown operation in this vfs module. It was tested to work
> with samba 3.6.24
> 
> --- vfs_crossrename.c.old	2014-06-23 08:03:27.000000000 +0200
> +++ vfs_crossrename.c.new	2014-06-24 00:00:20.159739000 +0200
> @@ -104,9 +104,9 @@
>  	 */
> 
>  #if defined(HAVE_FCHMOD)
> -	if (fchmod (ofd, source_stats.st_ex_mode & 07777))
> +	if (fchmod (ofd, source_stats.st_ex_mode & 07777) == -1 && (errno
> != EPERM))
>  #else
> -	if (chmod (dest, source_stats.st_ex_mode & 07777))
> +	if (chmod (dest, source_stats.st_ex_mode & 07777) == -1 && (errno
> != EPERM))
>  #endif
>  		goto err;

Thanks CurlyMo, looks good to me.

Can I get a second Team reviewer for the attached patch ?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-s3-modules-Ignore-EPERM-errors-on-f-chmod-in-crossre.patch
Type: text/x-diff
Size: 1101 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20140627/26e76205/attachment.patch>


More information about the samba-technical mailing list