Re: [PATCH 5/9] fallback to CIFSSMBQPathInfoBasic() in cifs_is_path_accessible()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 22 Nov 2013 11:26:54 +0100
Gregor Beck <gbeck@xxxxxxxxx> wrote:

> ---
>  smb1ops.c |   13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/smb1ops.c b/smb1ops.c
> index 6094397..635b1e5 100644
> --- a/smb1ops.c
> +++ b/smb1ops.c
> @@ -513,20 +513,23 @@ cifs_is_path_accessible(const unsigned int xid, struct cifs_tcon *tcon,
>  {
>  	int rc;
>  	FILE_ALL_INFO *file_info;
> +	const int remap = cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR;
>  

So many of the arguments to these functions always come from the
cifs_sb. Would it be reasonable to simply pass a cifs_sb pointer down
to these functions and cut out some of the argument bloat?

>  	file_info = kmalloc(sizeof(FILE_ALL_INFO), GFP_KERNEL);
>  	if (file_info == NULL)
>  		return -ENOMEM;
>  
>  	rc = CIFSSMBQPathInfo(xid, tcon, full_path, file_info,
> -			      0 /* not legacy */, cifs_sb->local_nls,
> -			      cifs_sb->mnt_cifs_flags &
> -				CIFS_MOUNT_MAP_SPECIAL_CHR);
> +			      0 /* not legacy */, cifs_sb->local_nls, remap);
> +	if (rc == -EIO) {
> +		rc = CIFSSMBQPathInfoBasic(xid, tcon, full_path,
> +					   (FILE_BASIC_INFO*)file_info,
> +					   cifs_sb->local_nls, remap);
> +	}
>  
>  	if (rc == -EOPNOTSUPP || rc == -EINVAL)
>  		rc = SMBQueryInformation(xid, tcon, full_path, file_info,
> -				cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
> -				  CIFS_MOUNT_MAP_SPECIAL_CHR);
> +					 cifs_sb->local_nls, remap);
>  	kfree(file_info);
>  	return rc;
>  }

-EIO can happen for a lot of different reasons, but there's little harm
in retrying with a more basic call in this function. In fact, it might
make more sense to just always use CIFSSMBQPathInfoBasic here since we
don't actually do anything with the returned info.

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




[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux