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

CurlyMo curlymoo1 at gmail.com
Mon Jun 23 16:54:27 MDT 2014


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;





More information about the samba-technical mailing list