Skip to content

Commit

Permalink
cifs: Check server capability before attempting silly rename
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Jeff Layton <[email protected]>
Signed-off-by: Steve French <[email protected]>
  • Loading branch information
spuiuk authored and Steve French committed Mar 7, 2013
1 parent 72d282d commit c483a98
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions fs/cifs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -995,6 +995,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,
Expand Down

0 comments on commit c483a98

Please sign in to comment.