[CIFS] move close processing from cifs_close to cifsFileInfo_put
[pandora-kernel.git] / fs / cifs / cifsfs.c
index 898d2a5..cb77915 100644 (file)
@@ -83,6 +83,24 @@ extern mempool_t *cifs_sm_req_poolp;
 extern mempool_t *cifs_req_poolp;
 extern mempool_t *cifs_mid_poolp;
 
+void
+cifs_sb_active(struct super_block *sb)
+{
+       struct cifs_sb_info *server = CIFS_SB(sb);
+
+       if (atomic_inc_return(&server->active) == 1)
+               atomic_inc(&sb->s_active);
+}
+
+void
+cifs_sb_deactive(struct super_block *sb)
+{
+       struct cifs_sb_info *server = CIFS_SB(sb);
+
+       if (atomic_dec_and_test(&server->active))
+               deactivate_super(sb);
+}
+
 static int
 cifs_read_super(struct super_block *sb, void *data,
                const char *devname, int silent)
@@ -98,6 +116,9 @@ cifs_read_super(struct super_block *sb, void *data,
        if (cifs_sb == NULL)
                return -ENOMEM;
 
+       spin_lock_init(&cifs_sb->tlink_tree_lock);
+       INIT_RADIX_TREE(&cifs_sb->tlink_tree, GFP_KERNEL);
+
        rc = bdi_setup_and_register(&cifs_sb->bdi, "cifs", BDI_CAP_MAP_COPY);
        if (rc) {
                kfree(cifs_sb);
@@ -369,8 +390,12 @@ cifs_show_options(struct seq_file *s, struct vfsmount *m)
        srcaddr = (struct sockaddr *)&tcon->ses->server->srcaddr;
 
        seq_printf(s, ",unc=%s", tcon->treeName);
-       if (tcon->ses->userName)
+
+       if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MULTIUSER)
+               seq_printf(s, ",multiuser");
+       else if (tcon->ses->userName)
                seq_printf(s, ",username=%s", tcon->ses->userName);
+
        if (tcon->ses->domainName)
                seq_printf(s, ",domain=%s", tcon->ses->domainName);
 
@@ -457,16 +482,16 @@ static void cifs_umount_begin(struct super_block *sb)
 
        tcon = cifs_sb_master_tcon(cifs_sb);
 
-       read_lock(&cifs_tcp_ses_lock);
+       spin_lock(&cifs_tcp_ses_lock);
        if ((tcon->tc_count > 1) || (tcon->tidStatus == CifsExiting)) {
                /* we have other mounts to same share or we have
                   already tried to force umount this and woken up
                   all waiting network requests, nothing to do */
-               read_unlock(&cifs_tcp_ses_lock);
+               spin_unlock(&cifs_tcp_ses_lock);
                return;
        } else if (tcon->tc_count == 1)
                tcon->tidStatus = CifsExiting;
-       read_unlock(&cifs_tcp_ses_lock);
+       spin_unlock(&cifs_tcp_ses_lock);
 
        /* cancel_brl_requests(tcon); */ /* BB mark all brl mids as exiting */
        /* cancel_notify_requests(tcon); */
@@ -595,7 +620,8 @@ static int cifs_setlease(struct file *file, long arg, struct file_lock **lease)
            ((arg == F_WRLCK) &&
                (CIFS_I(inode)->clientCanCacheAll)))
                return generic_setlease(file, arg, lease);
-       else if (cfile->tcon->local_lease && !CIFS_I(inode)->clientCanCacheRead)
+       else if (tlink_tcon(cfile->tlink)->local_lease &&
+                !CIFS_I(inode)->clientCanCacheRead)
                /* If the server claims to support oplock on this
                   file, then we still need to check oplock even
                   if the local_lease mount option is set, but there
@@ -914,8 +940,8 @@ init_cifs(void)
        GlobalTotalActiveXid = 0;
        GlobalMaxActiveXid = 0;
        memset(Local_System_Name, 0, 15);
-       rwlock_init(&GlobalSMBSeslock);
-       rwlock_init(&cifs_tcp_ses_lock);
+       spin_lock_init(&cifs_tcp_ses_lock);
+       spin_lock_init(&cifs_file_list_lock);
        spin_lock_init(&GlobalMid_Lock);
 
        if (cifs_max_pending < 2) {