Re: [PATCH 2/3] cifs: Check server capability before attempting silly rename

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

 



On Tue,  5 Mar 2013 19:25:56 +0000
Sachin Prabhu <sprabhu@xxxxxxxxxx> wrote:

> cifs_rename_pending_delete() attempts to silly rename file using
> CIFSSMBRenameOpenFile(). This uses the SET_FILE_INFORMATION TRANS2
> command with information level set to the passthru info-level
> SMB_SET_FILE_RENAME_INFORMATION.
> 
> We need to check to make sure that the server support passthru
> info-levels before attempting the silly rename or else we will fail to
> rename the file.
> 
> Signed-off-by: Sachin Prabhu <sprabhu@xxxxxxxxxx>
> ---
>  fs/cifs/inode.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
> index a183b9d..fee2d40 100644
> --- a/fs/cifs/inode.c
> +++ b/fs/cifs/inode.c
> @@ -986,6 +986,15 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry,
>  		return PTR_ERR(tlink);
>  	tcon = tlink_tcon(tlink);
>  
> +	/*
> +	 * We cannot rename the file if the server doesn't support
> +	 * CAP_INFOLEVEL_PASSTHRU
> +	 */
> +	if (!(tcon->ses->capabilities & CAP_INFOLEVEL_PASSTHRU)) {
> +		rc = -EBUSY;
> +		goto out;
> +	}
> +
>  	rc = CIFSSMBOpen(xid, tcon, full_path, FILE_OPEN,
>  			 DELETE|FILE_WRITE_ATTRIBUTES, CREATE_NOT_DIR,
>  			 &netfid, &oplock, NULL, cifs_sb->local_nls,

We almost certainly need to do the same in other places too. The cifs
code does too much "try and fall back" when it should first check for
capabilities. Keep your eyes open for others!

Reviewed-by: 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