提交 639e7a91 编写于 作者: J Jeff Layton 提交者: Steve French

cifs: eliminate redundant xdev check in cifs_rename

The VFS always checks that the source and target of a rename are on the
same vfsmount, and hence have the same superblock. So, this check is
redundant. Remove it and simplify the error handling.
Signed-off-by: NJeff Layton <jlayton@redhat.com>
Signed-off-by: NSteve French <sfrench@us.ibm.com>
上级 c8e56f1f
...@@ -1462,28 +1462,17 @@ int cifs_rename(struct inode *source_dir, struct dentry *source_dentry, ...@@ -1462,28 +1462,17 @@ int cifs_rename(struct inode *source_dir, struct dentry *source_dentry,
{ {
char *fromName = NULL; char *fromName = NULL;
char *toName = NULL; char *toName = NULL;
struct cifs_sb_info *cifs_sb_source; struct cifs_sb_info *cifs_sb;
struct cifs_sb_info *cifs_sb_target;
struct cifsTconInfo *tcon; struct cifsTconInfo *tcon;
FILE_UNIX_BASIC_INFO *info_buf_source = NULL; FILE_UNIX_BASIC_INFO *info_buf_source = NULL;
FILE_UNIX_BASIC_INFO *info_buf_target; FILE_UNIX_BASIC_INFO *info_buf_target;
int xid, rc, tmprc; int xid, rc, tmprc;
cifs_sb_target = CIFS_SB(target_dir->i_sb); cifs_sb = CIFS_SB(source_dir->i_sb);
cifs_sb_source = CIFS_SB(source_dir->i_sb); tcon = cifs_sb->tcon;
tcon = cifs_sb_source->tcon;
xid = GetXid(); xid = GetXid();
/*
* BB: this might be allowed if same server, but different share.
* Consider adding support for this
*/
if (tcon != cifs_sb_target->tcon) {
rc = -EXDEV;
goto cifs_rename_exit;
}
/* /*
* we already have the rename sem so we do not need to * we already have the rename sem so we do not need to
* grab it again here to protect the path integrity * grab it again here to protect the path integrity
...@@ -1519,17 +1508,16 @@ int cifs_rename(struct inode *source_dir, struct dentry *source_dentry, ...@@ -1519,17 +1508,16 @@ int cifs_rename(struct inode *source_dir, struct dentry *source_dentry,
info_buf_target = info_buf_source + 1; info_buf_target = info_buf_source + 1;
tmprc = CIFSSMBUnixQPathInfo(xid, tcon, fromName, tmprc = CIFSSMBUnixQPathInfo(xid, tcon, fromName,
info_buf_source, info_buf_source,
cifs_sb_source->local_nls, cifs_sb->local_nls,
cifs_sb_source->mnt_cifs_flags & cifs_sb->mnt_cifs_flags &
CIFS_MOUNT_MAP_SPECIAL_CHR); CIFS_MOUNT_MAP_SPECIAL_CHR);
if (tmprc != 0) if (tmprc != 0)
goto unlink_target; goto unlink_target;
tmprc = CIFSSMBUnixQPathInfo(xid, tcon, tmprc = CIFSSMBUnixQPathInfo(xid, tcon, toName,
toName, info_buf_target, info_buf_target,
cifs_sb_target->local_nls, cifs_sb->local_nls,
/* remap based on source sb */ cifs_sb->mnt_cifs_flags &
cifs_sb_source->mnt_cifs_flags &
CIFS_MOUNT_MAP_SPECIAL_CHR); CIFS_MOUNT_MAP_SPECIAL_CHR);
if (tmprc == 0 && (info_buf_source->UniqueId == if (tmprc == 0 && (info_buf_source->UniqueId ==
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册