]> err.no Git - linux-2.6/blobdiff - fs/cifs/cifsfs.c
Merge with /pub/scm/linux/kernel/git/torvalds/linux-2.6.git
[linux-2.6] / fs / cifs / cifsfs.c
index d77abe236a670b1e830df5e091070ba7a4d46877..1433455c61eafa9d651862dca8b0747a282ecf62 100644 (file)
@@ -205,6 +205,10 @@ cifs_statfs(struct super_block *sb, struct kstatfs *buf)
 #endif /* CIFS_EXPERIMENTAL */
        rc = CIFSSMBQFSInfo(xid, pTcon, buf);
 
+       /* Old Windows servers do not support level 103, retry with level 
+          one if old server failed the previous call */ 
+       if(rc)
+               rc = SMBOldQFSInfo(xid, pTcon, buf);
        /*     
           int f_type;
           __fsid_t f_fsid;
@@ -256,7 +260,7 @@ cifs_alloc_inode(struct super_block *sb)
        cifs_inode->clientCanCacheAll = FALSE;
        cifs_inode->vfs_inode.i_blksize = CIFS_MAX_MSGSIZE;
        cifs_inode->vfs_inode.i_blkbits = 14;  /* 2**14 = CIFS_MAX_MSGSIZE */
-
+       cifs_inode->vfs_inode.i_flags = S_NOATIME | S_NOCMTIME;
        INIT_LIST_HEAD(&cifs_inode->openFileList);
        return &cifs_inode->vfs_inode;
 }
@@ -401,6 +405,37 @@ static struct quotactl_ops cifs_quotactl_ops = {
 };
 #endif
 
+#ifdef CONFIG_CIFS_EXPERIMENTAL
+static void cifs_umount_begin(struct super_block * sblock)
+{
+       struct cifs_sb_info *cifs_sb;
+       struct cifsTconInfo * tcon;
+
+       cifs_sb = CIFS_SB(sblock);
+       if(cifs_sb == NULL)
+               return;
+
+       tcon = cifs_sb->tcon;
+       if(tcon == NULL)
+               return;
+       down(&tcon->tconSem);
+       if (atomic_read(&tcon->useCount) == 1)
+               tcon->tidStatus = CifsExiting;
+       up(&tcon->tconSem);
+
+       /* cancel_brl_requests(tcon); */
+       /* cancel_notify_requests(tcon); */
+       if(tcon->ses && tcon->ses->server)
+       {
+               cFYI(1,("wake up tasks now - umount begin not complete"));
+               wake_up_all(&tcon->ses->server->request_q);
+       }
+/* BB FIXME - finish add checks for tidStatus BB */
+
+       return;
+}
+#endif 
+
 static int cifs_remount(struct super_block *sb, int *flags, char *data)
 {
        *flags |= MS_NODIRATIME;
@@ -418,7 +453,9 @@ struct super_operations cifs_super_ops = {
    unless later we add lazy close of inodes or unless the kernel forgets to call
    us with the same number of releases (closes) as opens */
        .show_options = cifs_show_options,
-/*    .umount_begin   = cifs_umount_begin, *//* consider adding in the future */
+#ifdef CONFIG_CIFS_EXPERIMENTAL
+       .umount_begin   = cifs_umount_begin,
+#endif
        .remount_fs = cifs_remount,
 };
 
@@ -598,6 +635,46 @@ struct file_operations cifs_file_direct_ops = {
        .dir_notify = cifs_dir_notify,
 #endif /* CONFIG_CIFS_EXPERIMENTAL */
 };
+struct file_operations cifs_file_nobrl_ops = {
+        .read = cifs_read_wrapper,
+        .write = cifs_write_wrapper,
+        .open = cifs_open,
+        .release = cifs_close,
+        .fsync = cifs_fsync,
+        .flush = cifs_flush,
+        .mmap  = cifs_file_mmap,
+        .sendfile = generic_file_sendfile,
+#ifdef CONFIG_CIFS_POSIX
+        .ioctl  = cifs_ioctl,
+#endif /* CONFIG_CIFS_POSIX */
+
+#ifdef CONFIG_CIFS_EXPERIMENTAL
+        .readv = generic_file_readv,
+        .writev = generic_file_writev,
+        .aio_read = generic_file_aio_read,
+        .aio_write = generic_file_aio_write,
+        .dir_notify = cifs_dir_notify,
+#endif /* CONFIG_CIFS_EXPERIMENTAL */
+};
+
+struct file_operations cifs_file_direct_nobrl_ops = {
+        /* no mmap, no aio, no readv -
+           BB reevaluate whether they can be done with directio, no cache */
+        .read = cifs_user_read,
+        .write = cifs_user_write,
+        .open = cifs_open,
+        .release = cifs_close,
+        .fsync = cifs_fsync,
+        .flush = cifs_flush,
+        .sendfile = generic_file_sendfile, /* BB removeme BB */
+#ifdef CONFIG_CIFS_POSIX
+        .ioctl  = cifs_ioctl,
+#endif /* CONFIG_CIFS_POSIX */
+
+#ifdef CONFIG_CIFS_EXPERIMENTAL
+        .dir_notify = cifs_dir_notify,
+#endif /* CONFIG_CIFS_EXPERIMENTAL */
+};
 
 struct file_operations cifs_dir_ops = {
        .readdir = cifs_readdir,
@@ -784,9 +861,9 @@ static int cifs_oplock_thread(void * dummyarg)
 
        oplockThread = current;
        do {
-               set_current_state(TASK_INTERRUPTIBLE);
+               if (try_to_freeze()) 
+                       continue;
                
-               schedule_timeout(1*HZ);  
                spin_lock(&GlobalMid_Lock);
                if(list_empty(&GlobalOplock_Q)) {
                        spin_unlock(&GlobalMid_Lock);
@@ -835,6 +912,8 @@ static int cifs_oplock_thread(void * dummyarg)
                                }
                        } else
                                spin_unlock(&GlobalMid_Lock);
+                       set_current_state(TASK_INTERRUPTIBLE);
+                       schedule_timeout(1);  /* yield in case q were corrupt */
                }
        } while(!signal_pending(current));
        oplockThread = NULL;
@@ -848,6 +927,8 @@ static int cifs_dnotify_thread(void * dummyarg)
 
        dnotifyThread = current;
        do {
+               if(try_to_freeze())
+                       continue;
                set_current_state(TASK_INTERRUPTIBLE);
                schedule_timeout(39*HZ);
        } while(!signal_pending(current));
@@ -865,6 +946,10 @@ init_cifs(void)
        INIT_LIST_HEAD(&GlobalSMBSessionList);
        INIT_LIST_HEAD(&GlobalTreeConnectionList);
        INIT_LIST_HEAD(&GlobalOplock_Q);
+#ifdef CONFIG_CIFS_EXPERIMENTAL
+       INIT_LIST_HEAD(&GlobalDnotifyReqList);
+       INIT_LIST_HEAD(&GlobalDnotifyRsp_Q);
+#endif 
 /*
  *  Initialize Global counters
  */