[PATCH] vfs_gpfs: Asjust debug level when get_winattrs returns EBADF

Swen Schillig swen at vnet.ibm.com
Thu May 24 07:46:14 UTC 2018


Hi CHristof

On Wed, 2018-05-23 at 15:55 -0700, Christof Schmitt via samba-technical 
wrote:
> Small fix for vfs_gpfs module.
> 
> Please review.
> 
> Christof
+	if (ret == -1 && errno == EBADF) {
+		/*
+		 * Returned for directory listings in gpfs root for
+		 * .. entry which steps out of gpfs.
+		 */
+		DBG_DEBUG("Getting winattrs for %s returned EBADF.\n",
+			  smb_fname->base_name);
+	} else if (ret == -1) {

I don't think you want to return with NT_STATUS_OK 
in case of errno == EBADF.

Why not consolidating the errors a bit with a switch statement?
So something like this 

diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index a0fd48fab7c..e156922b9a2 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -1605,17 +1605,27 @@ static NTSTATUS vfs_gpfs_get_dos_attributes(struct vfs_handle_struct *handle,
        }
 
        ret = gpfswrap_get_winattrs_path(smb_fname->base_name, &attrs);
-       if (ret == -1 && errno == ENOSYS) {
-               return SMB_VFS_NEXT_GET_DOS_ATTRIBUTES(handle, smb_fname,
-                                                      dosmode);
-       }
-       if (ret == -1 && errno == EACCES) {
-               ret = get_dos_attr_with_capability(smb_fname, &attrs);
-       }
        if (ret == -1) {
-               DBG_WARNING("Getting winattrs failed for %s: %s\n",
-                           smb_fname->base_name, strerror(errno));
-               return map_nt_error_from_unix(errno);
+               switch(errno) {
+               case ENOSYS:
+                       return SMB_VFS_NEXT_GET_DOS_ATTRIBUTES(handle,
+                                                              smb_fname,
+                                                              dosmode);
+                       break;
+               case EACCES:
+                       ret = get_dos_attr_with_capability(smb_fname, &attrs);
+                       break;
+               case EBADF:
+                       DBG_DEBUG("Getting winattrs for %s returned EBADF.\n",
+                                  smb_fname->base_name);
+                       return map_nt_error_from_unix(errno);
+                       break;
+               default:
+                       DBG_WARNING("Getting winattrs failed for %s: %s\n",
+                                   smb_fname->base_name,
+                                   strerror(errno));
+                       return map_nt_error_from_unix(errno);
+               }
        }
 
        *dosmode |= vfs_gpfs_winattrs_to_dosmode(attrs.winAttrs);




More information about the samba-technical mailing list