diff options
Diffstat (limited to 'fs/cifs/inode.c')
-rw-r--r-- | fs/cifs/inode.c | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 4bc47e5b5f29..53cce8cc2224 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -801,6 +801,8 @@ retry_iget5_locked: | |||
801 | inode->i_flags |= S_NOATIME | S_NOCMTIME; | 801 | inode->i_flags |= S_NOATIME | S_NOCMTIME; |
802 | if (inode->i_state & I_NEW) { | 802 | if (inode->i_state & I_NEW) { |
803 | inode->i_ino = hash; | 803 | inode->i_ino = hash; |
804 | if (S_ISREG(inode->i_mode)) | ||
805 | inode->i_data.backing_dev_info = sb->s_bdi; | ||
804 | #ifdef CONFIG_CIFS_FSCACHE | 806 | #ifdef CONFIG_CIFS_FSCACHE |
805 | /* initialize per-inode cache cookie pointer */ | 807 | /* initialize per-inode cache cookie pointer */ |
806 | CIFS_I(inode)->fscache = NULL; | 808 | CIFS_I(inode)->fscache = NULL; |
@@ -834,7 +836,7 @@ struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino) | |||
834 | xid, NULL); | 836 | xid, NULL); |
835 | 837 | ||
836 | if (!inode) | 838 | if (!inode) |
837 | return ERR_PTR(-ENOMEM); | 839 | return ERR_PTR(rc); |
838 | 840 | ||
839 | #ifdef CONFIG_CIFS_FSCACHE | 841 | #ifdef CONFIG_CIFS_FSCACHE |
840 | /* populate tcon->resource_id */ | 842 | /* populate tcon->resource_id */ |
@@ -1462,29 +1464,18 @@ int cifs_rename(struct inode *source_dir, struct dentry *source_dentry, | |||
1462 | { | 1464 | { |
1463 | char *fromName = NULL; | 1465 | char *fromName = NULL; |
1464 | char *toName = NULL; | 1466 | char *toName = NULL; |
1465 | struct cifs_sb_info *cifs_sb_source; | 1467 | struct cifs_sb_info *cifs_sb; |
1466 | struct cifs_sb_info *cifs_sb_target; | ||
1467 | struct cifsTconInfo *tcon; | 1468 | struct cifsTconInfo *tcon; |
1468 | FILE_UNIX_BASIC_INFO *info_buf_source = NULL; | 1469 | FILE_UNIX_BASIC_INFO *info_buf_source = NULL; |
1469 | FILE_UNIX_BASIC_INFO *info_buf_target; | 1470 | FILE_UNIX_BASIC_INFO *info_buf_target; |
1470 | int xid, rc, tmprc; | 1471 | int xid, rc, tmprc; |
1471 | 1472 | ||
1472 | cifs_sb_target = CIFS_SB(target_dir->i_sb); | 1473 | cifs_sb = CIFS_SB(source_dir->i_sb); |
1473 | cifs_sb_source = CIFS_SB(source_dir->i_sb); | 1474 | tcon = cifs_sb->tcon; |
1474 | tcon = cifs_sb_source->tcon; | ||
1475 | 1475 | ||
1476 | xid = GetXid(); | 1476 | xid = GetXid(); |
1477 | 1477 | ||
1478 | /* | 1478 | /* |
1479 | * BB: this might be allowed if same server, but different share. | ||
1480 | * Consider adding support for this | ||
1481 | */ | ||
1482 | if (tcon != cifs_sb_target->tcon) { | ||
1483 | rc = -EXDEV; | ||
1484 | goto cifs_rename_exit; | ||
1485 | } | ||
1486 | |||
1487 | /* | ||
1488 | * we already have the rename sem so we do not need to | 1479 | * we already have the rename sem so we do not need to |
1489 | * grab it again here to protect the path integrity | 1480 | * grab it again here to protect the path integrity |
1490 | */ | 1481 | */ |
@@ -1519,17 +1510,16 @@ int cifs_rename(struct inode *source_dir, struct dentry *source_dentry, | |||
1519 | info_buf_target = info_buf_source + 1; | 1510 | info_buf_target = info_buf_source + 1; |
1520 | tmprc = CIFSSMBUnixQPathInfo(xid, tcon, fromName, | 1511 | tmprc = CIFSSMBUnixQPathInfo(xid, tcon, fromName, |
1521 | info_buf_source, | 1512 | info_buf_source, |
1522 | cifs_sb_source->local_nls, | 1513 | cifs_sb->local_nls, |
1523 | cifs_sb_source->mnt_cifs_flags & | 1514 | cifs_sb->mnt_cifs_flags & |
1524 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 1515 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
1525 | if (tmprc != 0) | 1516 | if (tmprc != 0) |
1526 | goto unlink_target; | 1517 | goto unlink_target; |
1527 | 1518 | ||
1528 | tmprc = CIFSSMBUnixQPathInfo(xid, tcon, | 1519 | tmprc = CIFSSMBUnixQPathInfo(xid, tcon, toName, |
1529 | toName, info_buf_target, | 1520 | info_buf_target, |
1530 | cifs_sb_target->local_nls, | 1521 | cifs_sb->local_nls, |
1531 | /* remap based on source sb */ | 1522 | cifs_sb->mnt_cifs_flags & |
1532 | cifs_sb_source->mnt_cifs_flags & | ||
1533 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 1523 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
1534 | 1524 | ||
1535 | if (tmprc == 0 && (info_buf_source->UniqueId == | 1525 | if (tmprc == 0 && (info_buf_source->UniqueId == |