diff mbox series

[WIP] do not ignore error on setinfo for chmod

Message ID CAH2r5mu-4wZ7p4NDyT9k=fdSHfD_fL0tYyNL5mZV2dugWZoXYg@mail.gmail.com (mailing list archive)
State New, archived
Headers show
Series [WIP] do not ignore error on setinfo for chmod | expand

Commit Message

Steve French Aug. 1, 2019, 6:05 p.m. UTC
We were incorrectly skipping errors in some cases in cifs_settattr_nounix
diff mbox series

Patch

From d8423388e07b16dc508ed453637879f47bebd1b1 Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
Date: Thu, 1 Aug 2019 12:21:14 -0500
Subject: [PATCH] cifs: fix error handling on chmod

We were ignoring errors on chmod due to incorrect check of
which attributes were being changed (certain timestamp setting
errors can be safely ignored but not chmod).

Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/cifs/inode.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 26cdfbf1e164..25a5aeddc09a 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -2559,12 +2559,14 @@  cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
 		/* BB: check for rc = -EOPNOTSUPP and switch to legacy mode */
 
 		/* Even if error on time set, no sense failing the call if
-		the server would set the time to a reasonable value anyway,
-		and this check ensures that we are not being called from
-		sys_utimes in which case we ought to fail the call back to
-		the user when the server rejects the call */
-		if ((rc) && (attrs->ia_valid &
-				(ATTR_MODE | ATTR_GID | ATTR_UID | ATTR_SIZE)))
+		 * the server would set the time to a reasonable value anyway.
+		 * TODO check if check to ensure that are not being called from
+		 * sys_utimes (in which case we ought to fail the call when the
+		 * server rejects the call) is correct. We do want
+	         * to return an rc if error setting mode or owner or size
+		 */
+		if (rc && ((attrs->ia_valid &
+		      (ATTR_MODE | ATTR_GID | ATTR_UID | ATTR_SIZE)) == 0))
 			rc = 0;
 	}
 
-- 
2.20.1