Skip to contentSkip to conversation

cifs: Percolate error up to the caller during get/set acls [try #3]

PATCH In review [email protected] 2 participants 4 messages Nov 9, 2010 – Nov 10, 2010 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cifs: Percolate error up to the caller during get/set acls [try #3]

From: Shirish Pargaonkar <[email protected]>

Modify get/set_cifs_acl* calls to reutrn error code and percolate the error code up to the caller.

Even though, function cifs_acl_to_fattr() now returns a return code, it is not yet handled by the caller of cifs_acl_to_fattr(). I would suggest to make that change, a part of another patch.

---
 fs/cifs/cifsacl.c   |   44 ++++++++++++++++++++++++++------------------
 fs/cifs/cifsproto.h |    2 +-
 2 files changed, 27 insertions(+), 19 deletions(-)
fs/cifs/cifsacl.c +26 -18
index c9b4792..cf53f7d 100644
@@ -560,7 +560,7 @@ static struct cifs_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb,
 	struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
 
 	if (IS_ERR(tlink))
-		return NULL;
+		ERR_CAST(tlink);
 
 	xid = GetXid();
 	rc = CIFSSMBGetCIFSACL(xid, tlink_tcon(tlink), fid, &pntsd, pacllen);
@@ -568,7 +568,9 @@ static struct cifs_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb,
 
 	cifs_put_tlink(tlink);
 
-	cFYI(1, "GetCIFSACL rc = %d ACL len %d", rc, *pacllen);
+	cFYI(1, "%s: rc = %d ACL len %d", __func__, rc, *pacllen);
+	if (rc)
+		return ERR_PTR(rc);
 	return pntsd;
 }
 
@@ -583,7 +585,7 @@ static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb,
 	struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
 
 	if (IS_ERR(tlink))
-		return NULL;
+		ERR_CAST(tlink);
 
 	tcon = tlink_tcon(tlink);
 	xid = GetXid();
@@ -591,18 +593,17 @@ static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb,
 	rc = CIFSSMBOpen(xid, tcon, path, FILE_OPEN, READ_CONTROL, 0,
 			 &fid, &oplock, NULL, cifs_sb->local_nls,
 			 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
-	if (rc) {
-		cERROR(1, "Unable to open file to get ACL");
-		goto out;
+	if (!rc) {
+		rc = CIFSSMBGetCIFSACL(xid, tcon, fid, &pntsd, pacllen);
+		CIFSSMBClose(xid, tcon, fid);
 	}
 
-	rc = CIFSSMBGetCIFSACL(xid, tcon, fid, &pntsd, pacllen);
-	cFYI(1, "GetCIFSACL rc = %d ACL len %d", rc, *pacllen);
-
-	CIFSSMBClose(xid, tcon, fid);
- out:
 	cifs_put_tlink(tlink);
 	FreeXid(xid);
+
+	cFYI(1, "%s: rc = %d ACL len %d", __func__, rc, *pacllen);
+	if (rc)
+		return ERR_PTR(rc);
 	return pntsd;
 }
 
@@ -695,7 +696,7 @@ static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
 }
 
 /* Translate the CIFS ACL (simlar to NTFS ACL) for a file into mode bits */
-void
+int
 cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr,
 		  struct inode *inode, const char *path, const __u16 *pfid)
 {
@@ -711,13 +712,17 @@ cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr,
 		pntsd = get_cifs_acl(cifs_sb, inode, path, &acllen);
 
 	/* if we can retrieve the ACL, now parse Access Control Entries, ACEs */
-	if (pntsd)
+	if (IS_ERR(pntsd)) {
+		rc = PTR_ERR(pntsd);
+		cERROR(1, "%s: error %d getting sec desc", __func__, rc);
+	} else {
 		rc = parse_sec_desc(pntsd, acllen, fattr);
-	if (rc)
-		cFYI(1, "parse sec desc failed rc = %d", rc);
+		kfree(pntsd);
+		if (rc)
+			cERROR(1, "parse sec desc failed rc = %d", rc);
+	}
 
-	kfree(pntsd);
-	return;
+	return rc;
 }
 
 /* Convert mode bits to an ACL so we can update the ACL on the server */
@@ -736,7 +741,10 @@ int mode_to_acl(struct inode *inode, const char *path, __u64 nmode)
 	/* Add three ACEs for owner, group, everyone getting rid of
 	   other ACEs as chmod disables ACEs and set the security descriptor */
 
-	if (pntsd) {
+	if (IS_ERR(pntsd)) {
+		rc = PTR_ERR(pntsd);
+		cERROR(1, "%s: error %d getting sec desc", __func__, rc);
+	} else {
 		/* allocate memory for the smb header,
 		   set security descriptor request security descriptor
 		   parameters, and secuirty descriptor itself */
fs/cifs/cifsproto.h +1 -1
index 7ed69b6..6ed59af 100644
@@ -130,7 +130,7 @@ extern int cifs_get_file_info_unix(struct file *filp);
 extern int cifs_get_inode_info_unix(struct inode **pinode,
 			const unsigned char *search_path,
 			struct super_block *sb, int xid);
-extern void cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb,
+extern int cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb,
 			      struct cifs_fattr *fattr, struct inode *inode,
 			      const char *path, const __u16 *pfid);
 extern int mode_to_acl(struct inode *inode, const char *path, __u64);
Signature · 1 line
1.6.0.2

A message that is not in the archive (sent off-list or not yet received): 1289341528-3675-1-git-send-email-shirishpargaonkar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#2 lore raw
Quoted 134 lines · On Tue, Nov 9, 2010 at 4:25 PM, <shirishpargaonkar-Re5JQEeQqe8AvxtiuMwx3w@publ…

From: Shirish Pargaonkar <[email protected]>

Modify get/set_cifs_acl* calls to reutrn error code and percolate the error code up to the caller.

Even though, function cifs_acl_to_fattr() now returns a return code, it is not yet handled by the caller of cifs_acl_to_fattr(). I would suggest to make that change, a part of another patch.

---
 fs/cifs/cifsacl.c   |   44 ++++++++++++++++++++++++++------------------ fs/cifs/cifsproto.h |    2 +-

 2 files changed, 27 insertions(+), 19 deletions(-)
fs/cifs/cifsacl.c +22 -17
index c9b4792..cf53f7d 100644
@@ -560,7 +560,7 @@ static struct cifs_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb,
        struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
 
        if (IS_ERR(tlink))
-               return NULL;
+               ERR_CAST(tlink);
 
        xid = GetXid();
        rc = CIFSSMBGetCIFSACL(xid, tlink_tcon(tlink), fid, &pntsd, pacllen);
@@ -568,7 +568,9 @@ static struct cifs_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb,
 
        cifs_put_tlink(tlink);
 
-       cFYI(1, "GetCIFSACL rc = %d ACL len %d", rc, *pacllen);
+       cFYI(1, "%s: rc = %d ACL len %d", __func__, rc, *pacllen);
+       if (rc)
+               return ERR_PTR(rc);
        return pntsd;
  }
 
@@ -583,7 +585,7 @@ static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb,
        struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
 
        if (IS_ERR(tlink))
-               return NULL;
+               ERR_CAST(tlink);
 
        tcon = tlink_tcon(tlink);
        xid = GetXid();
@@ -591,18 +593,17 @@ static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb,
        rc = CIFSSMBOpen(xid, tcon, path, FILE_OPEN, READ_CONTROL, 0,
                         &fid, &oplock, NULL, cifs_sb->local_nls,
                         cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
-       if (rc) {
-               cERROR(1, "Unable to open file to get ACL");
-               goto out;
+       if (!rc) {
+               rc = CIFSSMBGetCIFSACL(xid, tcon, fid, &pntsd, pacllen);
+               CIFSSMBClose(xid, tcon, fid);
        }
 
-       rc = CIFSSMBGetCIFSACL(xid, tcon, fid, &pntsd, pacllen);
-       cFYI(1, "GetCIFSACL rc = %d ACL len %d", rc, *pacllen);
-
-       CIFSSMBClose(xid, tcon, fid);
- out:
        cifs_put_tlink(tlink);
        FreeXid(xid);
+
+       cFYI(1, "%s: rc = %d ACL len %d", __func__, rc, *pacllen);
+       if (rc)
+               return ERR_PTR(rc);
        return pntsd;
  }
 
@@ -695,7 +696,7 @@ static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
  }
 
  /* Translate the CIFS ACL (simlar to NTFS ACL) for a file into mode bits */
-void
+int
  cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr,
                  struct inode *inode, const char *path, const __u16 *pfid)
  {
@@ -711,13 +712,17 @@ cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr,
                pntsd = get_cifs_acl(cifs_sb, inode, path, &acllen);
 
        /* if we can retrieve the ACL, now parse Access Control Entries, ACEs */
-       if (pntsd)
+       if (IS_ERR(pntsd)) {
+               rc = PTR_ERR(pntsd);
+               cERROR(1, "%s: error %d getting sec desc", __func__, rc);
+       } else {
                rc = parse_sec_desc(pntsd, acllen, fattr);
-       if (rc)
-               cFYI(1, "parse sec desc failed rc = %d", rc);
+               kfree(pntsd);
+               if (rc)
+                       cERROR(1, "parse sec desc failed rc = %d", rc);
+       }
 
-       kfree(pntsd);
-       return;
+       return rc;
  }
 
  /* Convert mode bits to an ACL so we can update the ACL on the server */
@@ -736,7 +741,10 @@ int mode_to_acl(struct inode *inode, const char *path, __u64 nmode)
        /* Add three ACEs for owner, group, everyone getting rid of

          other ACEs as chmod disables ACEs and set the security descriptor */

-       if (pntsd) {
+       if (IS_ERR(pntsd)) {
+               rc = PTR_ERR(pntsd);
+               cERROR(1, "%s: error %d getting sec desc", __func__, rc);
+       } else {
               /* allocate memory for the smb header,
                  set security descriptor request security descriptor parameters, and secuirty descriptor itself */

fs/cifs/cifsproto.h +1 -2
index 7ed69b6..6ed59af 100644
@@ -130,7 +130,7 @@ extern int cifs_get_file_info_unix(struct file *filp);
  extern int cifs_get_inode_info_unix(struct inode **pinode,
                        const unsigned char *search_path,
                        struct super_block *sb, int xid);
-extern void cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb,
+extern int cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb,
                              struct cifs_fattr *fattr, struct inode *inode,
                              const char *path, const __u16 *pfid);
  extern int mode_to_acl(struct inode *inode, const char *path, __u64);
--
Quoted 3 lines

1.6.0.2

There is no change of behaviour with this patch the way connectathon tests run. mode changes on the server are reflected correctly on the client as well.

There is a bug in cifs module which manifests in inability to unload itself from memory when general tests (-g -f) of connectathon are run, either against a Samba server or a Windows server, with or without mount option cifsacl (-o cifsacl) and with or without this patch.

# rmmod cifs
ERROR: Module cifs is in use

But at least error is percolated up to the caller now (cifs_acl_to_fattr()) and handling that error should be handled in another patch, IMHO.

So these two issues need to be addressed but this patch does not introduce any adverse behaviour and is ready to merge if there are no further comments/suggestions for change.

#3 lore raw
In reply to a message not in the archive
Quoted 22 lines · On Tue, 9 Nov 2010 16:25:28 -0600 shirishpargaonkar-Re5JQEeQqe8AvxtiuMwx3w@pub…

From: Shirish Pargaonkar <[email protected]>

Modify get/set_cifs_acl* calls to reutrn error code and percolate the error code up to the caller.

Even though, function cifs_acl_to_fattr() now returns a return code, it is not yet handled by the caller of cifs_acl_to_fattr(). I would suggest to make that change, a part of another patch.

---
 fs/cifs/cifsacl.c   |   44 ++++++++++++++++++++++++++------------------
 fs/cifs/cifsproto.h |    2 +-
 2 files changed, 27 insertions(+), 19 deletions(-)
fs/cifs/cifsacl.c +0 -0
index c9b4792..cf53f7d 100644

fs/cifs/cifsacl.c static struct cifs_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb, · line 563

Quoted 5 lines
fs/cifs/cifsacl.c +1 -1
@@ -560,7 +560,7 @@ static struct cifs_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb,
 	struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
 
 	if (IS_ERR(tlink))
-		return NULL;
+		ERR_CAST(tlink);
		^^^^^^^^
		ERR_CAST doesn't do anything but recast the pointer. Don't you want to return here?
Quoted 15 lines
fs/cifs/cifsacl.c +3 -1
 	xid = GetXid();
 	rc = CIFSSMBGetCIFSACL(xid, tlink_tcon(tlink), fid, &pntsd, pacllen);
@@ -568,7 +568,9 @@ static struct cifs_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb,
 
 	cifs_put_tlink(tlink);
 
-	cFYI(1, "GetCIFSACL rc = %d ACL len %d", rc, *pacllen);
+	cFYI(1, "%s: rc = %d ACL len %d", __func__, rc, *pacllen);
+	if (rc)
+		return ERR_PTR(rc);
 	return pntsd;
 }
 

fs/cifs/cifsacl.c static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb, · line 588

Quoted 5 lines
fs/cifs/cifsacl.c +1 -1
@@ -583,7 +585,7 @@ static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb,
 	struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
 
 	if (IS_ERR(tlink))
-		return NULL;
+		ERR_CAST(tlink);
		^^^^^^^^
		and here?
Quoted 78 lines
fs/cifs/cifsacl.c +21 -15
 	tcon = tlink_tcon(tlink);
 	xid = GetXid();
@@ -591,18 +593,17 @@ static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb,
 	rc = CIFSSMBOpen(xid, tcon, path, FILE_OPEN, READ_CONTROL, 0,
 			 &fid, &oplock, NULL, cifs_sb->local_nls,
 			 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
-	if (rc) {
-		cERROR(1, "Unable to open file to get ACL");
-		goto out;
+	if (!rc) {
+		rc = CIFSSMBGetCIFSACL(xid, tcon, fid, &pntsd, pacllen);
+		CIFSSMBClose(xid, tcon, fid);
 	}
 
-	rc = CIFSSMBGetCIFSACL(xid, tcon, fid, &pntsd, pacllen);
-	cFYI(1, "GetCIFSACL rc = %d ACL len %d", rc, *pacllen);
-
-	CIFSSMBClose(xid, tcon, fid);
- out:
 	cifs_put_tlink(tlink);
 	FreeXid(xid);
+
+	cFYI(1, "%s: rc = %d ACL len %d", __func__, rc, *pacllen);
+	if (rc)
+		return ERR_PTR(rc);
 	return pntsd;
 }
 
@@ -695,7 +696,7 @@ static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
 }
 
 /* Translate the CIFS ACL (simlar to NTFS ACL) for a file into mode bits */
-void
+int
 cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr,
 		  struct inode *inode, const char *path, const __u16 *pfid)
 {
@@ -711,13 +712,17 @@ cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr,
 		pntsd = get_cifs_acl(cifs_sb, inode, path, &acllen);
 
 	/* if we can retrieve the ACL, now parse Access Control Entries, ACEs */
-	if (pntsd)
+	if (IS_ERR(pntsd)) {
+		rc = PTR_ERR(pntsd);
+		cERROR(1, "%s: error %d getting sec desc", __func__, rc);
+	} else {
 		rc = parse_sec_desc(pntsd, acllen, fattr);
-	if (rc)
-		cFYI(1, "parse sec desc failed rc = %d", rc);
+		kfree(pntsd);
+		if (rc)
+			cERROR(1, "parse sec desc failed rc = %d", rc);
+	}
 
-	kfree(pntsd);
-	return;
+	return rc;
 }
 
 /* Convert mode bits to an ACL so we can update the ACL on the server */
@@ -736,7 +741,10 @@ int mode_to_acl(struct inode *inode, const char *path, __u64 nmode)
 	/* Add three ACEs for owner, group, everyone getting rid of
 	   other ACEs as chmod disables ACEs and set the security descriptor */
 
-	if (pntsd) {
+	if (IS_ERR(pntsd)) {
+		rc = PTR_ERR(pntsd);
+		cERROR(1, "%s: error %d getting sec desc", __func__, rc);
+	} else {
 		/* allocate memory for the smb header,
 		   set security descriptor request security descriptor
 		   parameters, and secuirty descriptor itself */
fs/cifs/cifsproto.h +0 -0
index 7ed69b6..6ed59af 100644

fs/cifs/cifsproto.h extern int cifs_get_file_info_unix(struct file *filp); · line 136

Quoted 8 lines
fs/cifs/cifsproto.h +1 -1
@@ -130,7 +130,7 @@ extern int cifs_get_file_info_unix(struct file *filp);
 extern int cifs_get_inode_info_unix(struct inode **pinode,
 			const unsigned char *search_path,
 			struct super_block *sb, int xid);
-extern void cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb,
+extern int cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb,
 			      struct cifs_fattr *fattr, struct inode *inode,
 			      const char *path, const __u16 *pfid);
 extern int mode_to_acl(struct inode *inode, const char *path, __u64);

Ok, so to be clear...the decision is to continue ignoring errors from cifs_acl_to_fattr in cifs_get_inode_info?

Signature · 1 line
Jeff Layton <[email protected]>

A message that is not in the archive (sent off-list or not yet received): 20101110071936.162c988c-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org

#5 lore raw
Quoted 27 lines · Jeff Layton
Quoted 24 lines · On Tue,  9 Nov 2010 16:25:28 -0600 shirishpargaonkar-Re5JQEeQqe8AvxtiuMwx3w@pub…

From: Shirish Pargaonkar <[email protected]>

Modify get/set_cifs_acl* calls to reutrn error code and percolate the error code up to the caller.

Even though, function cifs_acl_to_fattr() now returns a return code, it is not yet handled by the caller of cifs_acl_to_fattr(). I would suggest to make that change, a part of another patch.

---
 fs/cifs/cifsacl.c   |   44 ++++++++++++++++++++++++++------------------ fs/cifs/cifsproto.h |    2 +-

 2 files changed, 27 insertions(+), 19 deletions(-)
fs/cifs/cifsacl.c +0 -0
index c9b4792..cf53f7d 100644
@@ -560,7 +560,7 @@ static struct cifs_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb,
       struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
 
Quoted 5 lines

fs/cifs/cifsacl.c static struct cifs_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb, · line 563

Quoted 3 lines
fs/cifs/cifsacl.c +1 -1
       if (IS_ERR(tlink))
-             return NULL;
+             ERR_CAST(tlink);

               ^^^^^^^^
               ERR_CAST doesn't do anything but recast the pointer. Don't you want to return here?

Yes, my bad. Will fix this.

Quoted 105 lines
Quoted 16 lines
fs/cifs/cifsacl.c +3 -1
       xid = GetXid();
       rc = CIFSSMBGetCIFSACL(xid, tlink_tcon(tlink), fid, &pntsd, pacllen);
@@ -568,7 +568,9 @@ static struct cifs_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb,
 
       cifs_put_tlink(tlink);
 
-     cFYI(1, "GetCIFSACL rc = %d ACL len %d", rc, *pacllen);
+     cFYI(1, "%s: rc = %d ACL len %d", __func__, rc, *pacllen);
+     if (rc)
+             return ERR_PTR(rc);
       return pntsd;
  }
 

fs/cifs/cifsacl.c static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb, · line 588

Quoted 5 lines
fs/cifs/cifsacl.c +1 -1
@@ -583,7 +585,7 @@ static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb,
       struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
 
       if (IS_ERR(tlink))
-             return NULL;
+             ERR_CAST(tlink);

               ^^^^^^^^
               and here?

Quoted 82 lines
fs/cifs/cifsacl.c +17 -14
       tcon = tlink_tcon(tlink);
       xid = GetXid();
@@ -591,18 +593,17 @@ static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb,
       rc = CIFSSMBOpen(xid, tcon, path, FILE_OPEN, READ_CONTROL, 0,
                        &fid, &oplock, NULL, cifs_sb->local_nls,
                        cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
-     if (rc) {
-             cERROR(1, "Unable to open file to get ACL");
-             goto out;
+     if (!rc) {
+             rc = CIFSSMBGetCIFSACL(xid, tcon, fid, &pntsd, pacllen);
+             CIFSSMBClose(xid, tcon, fid);
       }
 
-     rc = CIFSSMBGetCIFSACL(xid, tcon, fid, &pntsd, pacllen);
-     cFYI(1, "GetCIFSACL rc = %d ACL len %d", rc, *pacllen);
-
-     CIFSSMBClose(xid, tcon, fid);
- out:
       cifs_put_tlink(tlink);
       FreeXid(xid);
+
+     cFYI(1, "%s: rc = %d ACL len %d", __func__, rc, *pacllen);
+     if (rc)
+             return ERR_PTR(rc);
       return pntsd;
  }
 
@@ -695,7 +696,7 @@ static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
  }
 
  /* Translate the CIFS ACL (simlar to NTFS ACL) for a file into mode bits */
-void
+int
  cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr,
                 struct inode *inode, const char *path, const __u16 *pfid)
  {
@@ -711,13 +712,17 @@ cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr,
               pntsd = get_cifs_acl(cifs_sb, inode, path, &acllen);
 
       /* if we can retrieve the ACL, now parse Access Control Entries, ACEs */
-     if (pntsd)
+     if (IS_ERR(pntsd)) {
+             rc = PTR_ERR(pntsd);
+             cERROR(1, "%s: error %d getting sec desc", __func__, rc);
+     } else {
               rc = parse_sec_desc(pntsd, acllen, fattr);
-     if (rc)
-             cFYI(1, "parse sec desc failed rc = %d", rc);
+             kfree(pntsd);
+             if (rc)
+                     cERROR(1, "parse sec desc failed rc = %d", rc);
+     }
 
-     kfree(pntsd);
-     return;
+     return rc;
  }
 
  /* Convert mode bits to an ACL so we can update the ACL on the server */
@@ -736,7 +741,10 @@ int mode_to_acl(struct inode *inode, const char *path, __u64 nmode)
       /* Add three ACEs for owner, group, everyone getting rid of

         other ACEs as chmod disables ACEs and set the security descriptor */

-     if (pntsd) {
+     if (IS_ERR(pntsd)) {
+             rc = PTR_ERR(pntsd);
+             cERROR(1, "%s: error %d getting sec desc", __func__, rc);
+     } else {
              /* allocate memory for the smb header,
                 set security descriptor request security descriptor parameters, and secuirty descriptor itself */

fs/cifs/cifsproto.h +0 -1
index 7ed69b6..6ed59af 100644
@@ -130,7 +130,7 @@ extern int cifs_get_file_info_unix(struct file *filp);
  extern int cifs_get_inode_info_unix(struct inode **pinode,
                       const unsigned char *search_path,
                       struct super_block *sb, int xid);
-extern void cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb,
Quoted 8 lines

fs/cifs/cifsproto.h extern int cifs_get_file_info_unix(struct file *filp); · line 136

Quoted 4 lines
fs/cifs/cifsproto.h +1 -0
+extern int cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb,
                             struct cifs_fattr *fattr, struct inode *inode,
                             const char *path, const __u16 *pfid);
  extern int mode_to_acl(struct inode *inode, const char *path, __u64);

Ok, so to be clear...the decision is to continue ignoring errors from cifs_acl_to_fattr in cifs_get_inode_info?

Yes. I would like to keep the scope of this patch to return back errors. Will spend time on handling return code in cifs_acl_to_fattr and in mode_to_acl.

Quoted 8 lines

--
Jeff Layton <[email protected]> --
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to [email protected] More majordomo info at  http://vger.kernel.org/majordomo-info.html