Merge branch 'for-next' of git://git.samba.org/sfrench/cifs-2.6
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 22 Dec 2012 01:09:07 +0000 (17:09 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 22 Dec 2012 01:09:07 +0000 (17:09 -0800)
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

fs/cifs/cifs_debug.h
fs/cifs/cifsfs.c
fs/cifs/connect.c
fs/cifs/readdir.c

index 86e92ef2abc1e8c3aa5cdfe142acbc2adb73f9f0..69ae3d3c3b3159827ba073551146d72022caedcc 100644 (file)
@@ -37,7 +37,6 @@ void dump_smb(void *, int);
 #define CIFS_TIMER     0x04
 
 extern int cifsFYI;
-extern int cifsERROR;
 
 /*
  *     debug ON
@@ -64,10 +63,7 @@ do {                                                                 \
 
 /* error event message: e.g., i/o error */
 #define cifserror(fmt, ...)                                            \
-do {                                                                   \
-       if (cifsERROR)                                                  \
-               printk(KERN_ERR "CIFS VFS: " fmt "\n", ##__VA_ARGS__);  \
-} while (0)
+       printk(KERN_ERR "CIFS VFS: " fmt "\n", ##__VA_ARGS__);          \
 
 #define cERROR(set, fmt, ...)                                          \
 do {                                                                   \
index ce9f3c5421bf61d3d3bf828cc40820047c9b010c..f653835d067b3323a1eea5f32774326a4937ac09 100644 (file)
@@ -54,7 +54,6 @@
 #endif
 
 int cifsFYI = 0;
-int cifsERROR = 1;
 int traceSMB = 0;
 bool enable_oplocks = true;
 unsigned int linuxExtEnabled = 1;
index 7635b5db26a7d78fc0140ecc556054592388ad95..17c3643e595095597e90026ea6a337edb7bd8b0b 100644 (file)
@@ -1624,14 +1624,11 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
                case Opt_unc:
                        string = vol->UNC;
                        vol->UNC = match_strdup(args);
-                       if (vol->UNC == NULL) {
-                               kfree(string);
+                       if (vol->UNC == NULL)
                                goto out_nomem;
-                       }
 
                        convert_delimiter(vol->UNC, '\\');
                        if (vol->UNC[0] != '\\' || vol->UNC[1] != '\\') {
-                               kfree(string);
                                printk(KERN_ERR "CIFS: UNC Path does not "
                                                "begin with // or \\\\\n");
                                goto cifs_parse_mount_err;
@@ -1687,10 +1684,8 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
 
                        string = vol->prepath;
                        vol->prepath = match_strdup(args);
-                       if (vol->prepath == NULL) {
-                               kfree(string);
+                       if (vol->prepath == NULL)
                                goto out_nomem;
-                       }
                        /* Compare old prefixpath= option to new one */
                        if (!string || strcmp(string, vol->prepath))
                                printk(KERN_WARNING "CIFS: the value of the "
index 6002fdc920ae402dabad902e623b875288fa988e..cdd6ff48246b2d8e79ae79f5de747eac9059030e 100644 (file)
@@ -78,6 +78,7 @@ cifs_prime_dcache(struct dentry *parent, struct qstr *name,
        struct dentry *dentry, *alias;
        struct inode *inode;
        struct super_block *sb = parent->d_inode->i_sb;
+       struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
 
        cFYI(1, "%s: for %s", __func__, name->name);
 
@@ -91,10 +92,20 @@ cifs_prime_dcache(struct dentry *parent, struct qstr *name,
                int err;
 
                inode = dentry->d_inode;
-               /* update inode in place if i_ino didn't change */
-               if (inode && CIFS_I(inode)->uniqueid == fattr->cf_uniqueid) {
-                       cifs_fattr_to_inode(inode, fattr);
-                       goto out;
+               if (inode) {
+                       /*
+                        * If we're generating inode numbers, then we don't
+                        * want to clobber the existing one with the one that
+                        * the readdir code created.
+                        */
+                       if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM))
+                               fattr->cf_uniqueid = CIFS_I(inode)->uniqueid;
+
+                       /* update inode in place if i_ino didn't change */
+                       if (CIFS_I(inode)->uniqueid == fattr->cf_uniqueid) {
+                               cifs_fattr_to_inode(inode, fattr);
+                               goto out;
+                       }
                }
                err = d_invalidate(dentry);
                dput(dentry);