Commit 769cb858c23ba7379ea27208624b444cd7b61af2

Authored by Linus Torvalds

Merge branch 'for-next' of git://git.samba.org/sfrench/cifs-2.6

Pull CIFS fixes from Steve French:
 "Misc small cifs fixes"

* 'for-next' of git://git.samba.org/sfrench/cifs-2.6:
  cifs: eliminate cifsERROR variable
  cifs: don't compare uniqueids in cifs_prime_dcache unless server inode numbers are in use
  cifs: fix double-free of "string" in cifs_parse_mount_options

Showing 4 changed files Side-by-side Diff

fs/cifs/cifs_debug.h
... ... @@ -37,7 +37,6 @@
37 37 #define CIFS_TIMER 0x04
38 38  
39 39 extern int cifsFYI;
40   -extern int cifsERROR;
41 40  
42 41 /*
43 42 * debug ON
... ... @@ -64,10 +63,7 @@
64 63  
65 64 /* error event message: e.g., i/o error */
66 65 #define cifserror(fmt, ...) \
67   -do { \
68   - if (cifsERROR) \
69   - printk(KERN_ERR "CIFS VFS: " fmt "\n", ##__VA_ARGS__); \
70   -} while (0)
  66 + printk(KERN_ERR "CIFS VFS: " fmt "\n", ##__VA_ARGS__); \
71 67  
72 68 #define cERROR(set, fmt, ...) \
73 69 do { \
... ... @@ -54,7 +54,6 @@
54 54 #endif
55 55  
56 56 int cifsFYI = 0;
57   -int cifsERROR = 1;
58 57 int traceSMB = 0;
59 58 bool enable_oplocks = true;
60 59 unsigned int linuxExtEnabled = 1;
... ... @@ -1624,14 +1624,11 @@
1624 1624 case Opt_unc:
1625 1625 string = vol->UNC;
1626 1626 vol->UNC = match_strdup(args);
1627   - if (vol->UNC == NULL) {
1628   - kfree(string);
  1627 + if (vol->UNC == NULL)
1629 1628 goto out_nomem;
1630   - }
1631 1629  
1632 1630 convert_delimiter(vol->UNC, '\\');
1633 1631 if (vol->UNC[0] != '\\' || vol->UNC[1] != '\\') {
1634   - kfree(string);
1635 1632 printk(KERN_ERR "CIFS: UNC Path does not "
1636 1633 "begin with // or \\\\\n");
1637 1634 goto cifs_parse_mount_err;
1638 1635  
... ... @@ -1687,10 +1684,8 @@
1687 1684  
1688 1685 string = vol->prepath;
1689 1686 vol->prepath = match_strdup(args);
1690   - if (vol->prepath == NULL) {
1691   - kfree(string);
  1687 + if (vol->prepath == NULL)
1692 1688 goto out_nomem;
1693   - }
1694 1689 /* Compare old prefixpath= option to new one */
1695 1690 if (!string || strcmp(string, vol->prepath))
1696 1691 printk(KERN_WARNING "CIFS: the value of the "
... ... @@ -78,6 +78,7 @@
78 78 struct dentry *dentry, *alias;
79 79 struct inode *inode;
80 80 struct super_block *sb = parent->d_inode->i_sb;
  81 + struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
81 82  
82 83 cFYI(1, "%s: for %s", __func__, name->name);
83 84  
... ... @@ -91,10 +92,20 @@
91 92 int err;
92 93  
93 94 inode = dentry->d_inode;
94   - /* update inode in place if i_ino didn't change */
95   - if (inode && CIFS_I(inode)->uniqueid == fattr->cf_uniqueid) {
96   - cifs_fattr_to_inode(inode, fattr);
97   - goto out;
  95 + if (inode) {
  96 + /*
  97 + * If we're generating inode numbers, then we don't
  98 + * want to clobber the existing one with the one that
  99 + * the readdir code created.
  100 + */
  101 + if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM))
  102 + fattr->cf_uniqueid = CIFS_I(inode)->uniqueid;
  103 +
  104 + /* update inode in place if i_ino didn't change */
  105 + if (CIFS_I(inode)->uniqueid == fattr->cf_uniqueid) {
  106 + cifs_fattr_to_inode(inode, fattr);
  107 + goto out;
  108 + }
98 109 }
99 110 err = d_invalidate(dentry);
100 111 dput(dentry);