]> nv-tegra.nvidia Code Review - linux-3.10.git/commitdiff
Merge branch 'master' of /pub/scm/linux/kernel/git/torvalds/linux-2.6
authorSteve French <sfrench@us.ibm.com>
Fri, 15 Feb 2008 21:06:08 +0000 (21:06 +0000)
committerSteve French <sfrench@us.ibm.com>
Fri, 15 Feb 2008 21:06:08 +0000 (21:06 +0000)
1  2 
fs/cifs/cifs_dfs_ref.c
fs/cifs/cifsfs.c
fs/cifs/inode.c

diff --combined fs/cifs/cifs_dfs_ref.c
index dd3bba4134b53d8397150d461c28954d8c327330,6ad447529961c0939c84b1eba822cb7076e3817d..7f8838253410572397725dffd3d92abba884c20c
@@@ -259,18 -259,18 +259,18 @@@ static int add_mount_helper(struct vfsm
        int err;
  
        mntget(newmnt);
-       err = do_add_mount(newmnt, nd, nd->mnt->mnt_flags, mntlist);
+       err = do_add_mount(newmnt, nd, nd->path.mnt->mnt_flags, mntlist);
        switch (err) {
        case 0:
-               dput(nd->dentry);
-               mntput(nd->mnt);
-               nd->mnt = newmnt;
-               nd->dentry = dget(newmnt->mnt_root);
+               dput(nd->path.dentry);
+               mntput(nd->path.mnt);
+               nd->path.mnt = newmnt;
+               nd->path.dentry = dget(newmnt->mnt_root);
                break;
        case -EBUSY:
                /* someone else made a mount here whilst we were busy */
-               while (d_mountpoint(nd->dentry) &&
-                      follow_down(&nd->mnt, &nd->dentry))
+               while (d_mountpoint(nd->path.dentry) &&
+                      follow_down(&nd->path.mnt, &nd->path.dentry))
                        ;
                err = 0;
        default:
@@@ -286,7 -286,7 +286,7 @@@ static void dump_referral(const struct 
        cFYI(1, ("DFS: node path: %s", ref->node_name));
        cFYI(1, ("DFS: fl: %hd, srv_type: %hd", ref->flags, ref->server_type));
        cFYI(1, ("DFS: ref_flags: %hd, path_consumed: %hd", ref->ref_flag,
 -                              ref->PathConsumed));
 +                              ref->path_consumed));
  }
  
  
@@@ -307,8 -307,8 +307,8 @@@ cifs_dfs_follow_mountpoint(struct dentr
  
        xid = GetXid();
  
-       dput(nd->dentry);
-       nd->dentry = dget(dentry);
+       dput(nd->path.dentry);
+       nd->path.dentry = dget(dentry);
  
        cifs_sb = CIFS_SB(dentry->d_inode->i_sb);
        ses = cifs_sb->tcon->ses;
                                rc = -EINVAL;
                                goto out_err;
                        }
-                       mnt = cifs_dfs_do_refmount(nd->mnt, nd->dentry,
+                       mnt = cifs_dfs_do_refmount(nd->path.mnt,
+                                               nd->path.dentry,
                                                referrals[i].node_name);
                        cFYI(1, ("%s: cifs_dfs_do_refmount:%s , mnt:%p",
                                         __FUNCTION__,
        if (IS_ERR(mnt))
                goto out_err;
  
-       nd->mnt->mnt_flags |= MNT_SHRINKABLE;
+       nd->path.mnt->mnt_flags |= MNT_SHRINKABLE;
        rc = add_mount_helper(mnt, nd, &cifs_dfs_automount_list);
  
  out:
        cFYI(1, ("leaving %s" , __FUNCTION__));
        return ERR_PTR(rc);
  out_err:
-       path_release(nd);
+       path_put(&nd->path);
        goto out;
  }
  
diff --combined fs/cifs/cifsfs.c
index 29bbf655b99c5ad05e3798e359bae5e7ffeae73d,fcc434227691fe4cbd57d2d74b7780c0767804fb..a04b17e5a9d01dbf5b8af64323b38b9ec45b20e8
@@@ -147,10 -147,11 +147,11 @@@ cifs_read_super(struct super_block *sb
  #endif
        sb->s_blocksize = CIFS_MAX_MSGSIZE;
        sb->s_blocksize_bits = 14;      /* default 2**14 = CIFS_MAX_MSGSIZE */
-       inode = iget(sb, ROOT_I);
+       inode = cifs_iget(sb, ROOT_I);
  
-       if (!inode) {
-               rc = -ENOMEM;
+       if (IS_ERR(inode)) {
+               rc = PTR_ERR(inode);
+               inode = NULL;
                goto out_no_root;
        }
  
@@@ -203,8 -204,9 +204,8 @@@ cifs_put_super(struct super_block *sb
                return;
        }
        rc = cifs_umount(sb, cifs_sb);
 -      if (rc) {
 +      if (rc)
                cERROR(1, ("cifs_umount failed with return code %d", rc));
 -      }
  #ifdef CONFIG_CIFS_DFS_UPCALL
        if (cifs_sb->mountdata) {
                kfree(cifs_sb->mountdata);
@@@ -459,7 -461,7 +460,7 @@@ int cifs_xstate_get(struct super_block 
  
  static struct quotactl_ops cifs_quotactl_ops = {
        .set_xquota     = cifs_xquota_set,
 -      .get_xquota     = cifs_xquota_set,
 +      .get_xquota     = cifs_xquota_get,
        .set_xstate     = cifs_xstate_set,
        .get_xstate     = cifs_xstate_get,
  };
@@@ -470,7 -472,9 +471,7 @@@ static void cifs_umount_begin(struct vf
        struct cifs_sb_info *cifs_sb;
        struct cifsTconInfo *tcon;
  
 -#ifdef CONFIG_CIFS_DFS_UPCALL
        dfs_shrink_umount_helper(vfsmnt);
 -#endif /* CONFIG CIFS_DFS_UPCALL */
  
        if (!(flags & MNT_FORCE))
                return;
@@@ -517,7 -521,6 +518,6 @@@ static int cifs_remount(struct super_bl
  }
  
  static const struct super_operations cifs_super_ops = {
-       .read_inode = cifs_read_inode,
        .put_super = cifs_put_super,
        .statfs = cifs_statfs,
        .alloc_inode = cifs_alloc_inode,
@@@ -989,7 -992,9 +989,7 @@@ static int __ini
  init_cifs(void)
  {
        int rc = 0;
 -#ifdef CONFIG_PROC_FS
        cifs_proc_init();
 -#endif
  /*    INIT_LIST_HEAD(&GlobalServerList);*/    /* BB not implemented yet */
        INIT_LIST_HEAD(&GlobalSMBSessionList);
        INIT_LIST_HEAD(&GlobalTreeConnectionList);
   out_destroy_inodecache:
        cifs_destroy_inodecache();
   out_clean_proc:
 -#ifdef CONFIG_PROC_FS
        cifs_proc_clean();
 -#endif
        return rc;
  }
  
  static void __exit
  exit_cifs(void)
  {
 -      cFYI(0, ("exit_cifs"));
 -#ifdef CONFIG_PROC_FS
 +      cFYI(DBG2, ("exit_cifs"));
        cifs_proc_clean();
 -#endif
  #ifdef CONFIG_CIFS_DFS_UPCALL
        unregister_key_type(&key_type_dns_resolver);
  #endif
diff --combined fs/cifs/inode.c
index e7cd392a796a9ba06f081659772dde592e2c13b0,b1a4a65eaa08e0b24f1c1daf83700113f38a742b..1d8aa0385ef78435575993faead32b0091ff14a2
  #include "cifs_debug.h"
  #include "cifs_fs_sb.h"
  
 +
 +static void cifs_set_ops(struct inode *inode)
 +{
 +      struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
 +
 +      switch (inode->i_mode & S_IFMT) {
 +      case S_IFREG:
 +              inode->i_op = &cifs_file_inode_ops;
 +              if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) {
 +                      if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
 +                              inode->i_fop = &cifs_file_direct_nobrl_ops;
 +                      else
 +                              inode->i_fop = &cifs_file_direct_ops;
 +              } else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
 +                      inode->i_fop = &cifs_file_nobrl_ops;
 +              else { /* not direct, send byte range locks */
 +                      inode->i_fop = &cifs_file_ops;
 +              }
 +
 +
 +              /* check if server can support readpages */
 +              if (cifs_sb->tcon->ses->server->maxBuf <
 +                              PAGE_CACHE_SIZE + MAX_CIFS_HDR_SIZE)
 +                      inode->i_data.a_ops = &cifs_addr_ops_smallbuf;
 +              else
 +                      inode->i_data.a_ops = &cifs_addr_ops;
 +              break;
 +      case S_IFDIR:
 +              inode->i_op = &cifs_dir_inode_ops;
 +              inode->i_fop = &cifs_dir_ops;
 +              break;
 +      case S_IFLNK:
 +              inode->i_op = &cifs_symlink_inode_ops;
 +              break;
 +      default:
 +              init_special_inode(inode, inode->i_mode, inode->i_rdev);
 +              break;
 +      }
 +}
 +
  int cifs_get_inode_info_unix(struct inode **pinode,
        const unsigned char *search_path, struct super_block *sb, int xid)
  {
                cFYI(1, ("Size %ld and blocks %llu",
                        (unsigned long) inode->i_size,
                        (unsigned long long)inode->i_blocks));
 -              if (S_ISREG(inode->i_mode)) {
 -                      cFYI(1, ("File inode"));
 -                      inode->i_op = &cifs_file_inode_ops;
 -                      if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) {
 -                              if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
 -                                      inode->i_fop =
 -                                              &cifs_file_direct_nobrl_ops;
 -                              else
 -                                      inode->i_fop = &cifs_file_direct_ops;
 -                      } else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
 -                              inode->i_fop = &cifs_file_nobrl_ops;
 -                      else /* not direct, send byte range locks */
 -                              inode->i_fop = &cifs_file_ops;
 -
 -                      /* check if server can support readpages */
 -                      if (pTcon->ses->server->maxBuf <
 -                          PAGE_CACHE_SIZE + MAX_CIFS_HDR_SIZE)
 -                              inode->i_data.a_ops = &cifs_addr_ops_smallbuf;
 -                      else
 -                              inode->i_data.a_ops = &cifs_addr_ops;
 -              } else if (S_ISDIR(inode->i_mode)) {
 -                      cFYI(1, ("Directory inode"));
 -                      inode->i_op = &cifs_dir_inode_ops;
 -                      inode->i_fop = &cifs_dir_ops;
 -              } else if (S_ISLNK(inode->i_mode)) {
 -                      cFYI(1, ("Symbolic Link inode"));
 -                      inode->i_op = &cifs_symlink_inode_ops;
 -              /* tmp_inode->i_fop = */ /* do not need to set to anything */
 -              } else {
 -                      cFYI(1, ("Init special inode"));
 -                      init_special_inode(inode, inode->i_mode,
 -                                         inode->i_rdev);
 -              }
 +
 +              cifs_set_ops(inode);
        }
        return rc;
  }
@@@ -499,9 -490,9 +499,9 @@@ int cifs_get_inode_info(struct inode **
                        if (decode_sfu_inode(inode,
                                         le64_to_cpu(pfindData->EndOfFile),
                                         search_path,
 -                                       cifs_sb, xid)) {
 +                                       cifs_sb, xid))
                                cFYI(1, ("Unrecognized sfu inode type"));
 -                      }
 +
                        cFYI(1, ("sfu mode 0%o", inode->i_mode));
                } else {
                        inode->i_mode |= S_IFREG;
                        atomic_set(&cifsInfo->inUse, 1);
                }
  
 -              if (S_ISREG(inode->i_mode)) {
 -                      cFYI(1, ("File inode"));
 -                      inode->i_op = &cifs_file_inode_ops;
 -                      if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) {
 -                              if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
 -                                      inode->i_fop =
 -                                              &cifs_file_direct_nobrl_ops;
 -                              else
 -                                      inode->i_fop = &cifs_file_direct_ops;
 -                      } else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
 -                              inode->i_fop = &cifs_file_nobrl_ops;
 -                      else /* not direct, send byte range locks */
 -                              inode->i_fop = &cifs_file_ops;
 -
 -                      if (pTcon->ses->server->maxBuf <
 -                           PAGE_CACHE_SIZE + MAX_CIFS_HDR_SIZE)
 -                              inode->i_data.a_ops = &cifs_addr_ops_smallbuf;
 -                      else
 -                              inode->i_data.a_ops = &cifs_addr_ops;
 -              } else if (S_ISDIR(inode->i_mode)) {
 -                      cFYI(1, ("Directory inode"));
 -                      inode->i_op = &cifs_dir_inode_ops;
 -                      inode->i_fop = &cifs_dir_ops;
 -              } else if (S_ISLNK(inode->i_mode)) {
 -                      cFYI(1, ("Symbolic Link inode"));
 -                      inode->i_op = &cifs_symlink_inode_ops;
 -              } else {
 -                      init_special_inode(inode, inode->i_mode,
 -                                         inode->i_rdev);
 -              }
 +              cifs_set_ops(inode);
        }
        kfree(buf);
        return rc;
@@@ -566,10 -586,18 +566,18 @@@ static const struct inode_operations ci
  };
  
  /* gets root inode */
void cifs_read_inode(struct inode *inode)
struct inode *cifs_iget(struct super_block *sb, unsigned long ino)
  {
-       int xid, rc;
+       int xid;
        struct cifs_sb_info *cifs_sb;
+       struct inode *inode;
+       long rc;
+       inode = iget_locked(sb, ino);
+       if (!inode)
+               return ERR_PTR(-ENOMEM);
+       if (!(inode->i_state & I_NEW))
+               return inode;
  
        cifs_sb = CIFS_SB(inode->i_sb);
        xid = GetXid();
                inode->i_fop = &simple_dir_operations;
                inode->i_uid = cifs_sb->mnt_uid;
                inode->i_gid = cifs_sb->mnt_gid;
+               _FreeXid(xid);
+               iget_failed(inode);
+               return ERR_PTR(rc);
        }
  
-       /* can not call macro FreeXid here since in a void func */
+       unlock_new_inode(inode);
+       /* can not call macro FreeXid here since in a void func
+        * TODO: This is no longer true
+        */
        _FreeXid(xid);
+       return inode;
  }
  
  int cifs_unlink(struct inode *inode, struct dentry *direntry)
@@@ -817,7 -853,9 +833,7 @@@ static void posix_fill_in_inode(struct 
                cFYI(1, ("unknown inode type %d", type));
        }
  
 -#ifdef CONFIG_CIFS_DEBUG2
 -      cFYI(1, ("object type: %d", type));
 -#endif
 +      cFYI(DBG2, ("object type: %d", type));
        tmp_inode->i_uid = le64_to_cpu(pData->Uid);
        tmp_inode->i_gid = le64_to_cpu(pData->Gid);
        tmp_inode->i_nlink = le64_to_cpu(pData->Nlinks);
@@@ -1176,8 -1214,9 +1192,8 @@@ int cifs_rename(struct inode *source_in
                } /* if we can not get memory just leave rc as EEXIST */
        }
  
 -      if (rc) {
 +      if (rc)
                cFYI(1, ("rename rc %d", rc));
 -      }
  
        if ((rc == -EIO) || (rc == -EEXIST)) {
                int oplock = FALSE;