aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifsfs.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-09-26 13:10:35 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-26 13:10:35 -0400
commit07e2e6ba2761291aa182993ebba1f490b5005dcc (patch)
tree4179e6189472f3a2434bb5cae01ec8f694881955 /fs/cifs/cifsfs.c
parentd8f654ef6a55495e548427b997a388e0d5a1ffb4 (diff)
parent3321b791b2e8897323f8c044a0c77ff25781381c (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6: cifs: fix locking and list handling code in cifs_open and its helper [CIFS] Remove build warning cifs: fix problems with last two commits [CIFS] Fix build break when keys support turned off cifs: eliminate cifs_init_private cifs: convert oplock breaks to use slow_work facility (try #4) cifs: have cifsFileInfo hold an extra inode reference cifs: take read lock on GlobalSMBSes_lock in is_valid_oplock_break cifs: remove cifsInodeInfo.oplockPending flag cifs: fix oplock request handling in posix codepath [CIFS] Re-enable Lanman security
Diffstat (limited to 'fs/cifs/cifsfs.c')
-rw-r--r--fs/cifs/cifsfs.c93
1 files changed, 4 insertions, 89 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 90c5b39f0313..9a5e4f5f3122 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -64,9 +64,6 @@ unsigned int multiuser_mount = 0;
64unsigned int extended_security = CIFSSEC_DEF; 64unsigned int extended_security = CIFSSEC_DEF;
65/* unsigned int ntlmv2_support = 0; */ 65/* unsigned int ntlmv2_support = 0; */
66unsigned int sign_CIFS_PDUs = 1; 66unsigned int sign_CIFS_PDUs = 1;
67extern struct task_struct *oplockThread; /* remove sparse warning */
68struct task_struct *oplockThread = NULL;
69/* extern struct task_struct * dnotifyThread; remove sparse warning */
70static const struct super_operations cifs_super_ops; 67static const struct super_operations cifs_super_ops;
71unsigned int CIFSMaxBufSize = CIFS_MAX_MSGSIZE; 68unsigned int CIFSMaxBufSize = CIFS_MAX_MSGSIZE;
72module_param(CIFSMaxBufSize, int, 0); 69module_param(CIFSMaxBufSize, int, 0);
@@ -972,89 +969,12 @@ cifs_destroy_mids(void)
972 kmem_cache_destroy(cifs_oplock_cachep); 969 kmem_cache_destroy(cifs_oplock_cachep);
973} 970}
974 971
975static int cifs_oplock_thread(void *dummyarg)
976{
977 struct oplock_q_entry *oplock_item;
978 struct cifsTconInfo *pTcon;
979 struct inode *inode;
980 __u16 netfid;
981 int rc, waitrc = 0;
982
983 set_freezable();
984 do {
985 if (try_to_freeze())
986 continue;
987
988 spin_lock(&cifs_oplock_lock);
989 if (list_empty(&cifs_oplock_list)) {
990 spin_unlock(&cifs_oplock_lock);
991 set_current_state(TASK_INTERRUPTIBLE);
992 schedule_timeout(39*HZ);
993 } else {
994 oplock_item = list_entry(cifs_oplock_list.next,
995 struct oplock_q_entry, qhead);
996 cFYI(1, ("found oplock item to write out"));
997 pTcon = oplock_item->tcon;
998 inode = oplock_item->pinode;
999 netfid = oplock_item->netfid;
1000 spin_unlock(&cifs_oplock_lock);
1001 DeleteOplockQEntry(oplock_item);
1002 /* can not grab inode sem here since it would
1003 deadlock when oplock received on delete
1004 since vfs_unlink holds the i_mutex across
1005 the call */
1006 /* mutex_lock(&inode->i_mutex);*/
1007 if (S_ISREG(inode->i_mode)) {
1008#ifdef CONFIG_CIFS_EXPERIMENTAL
1009 if (CIFS_I(inode)->clientCanCacheAll == 0)
1010 break_lease(inode, FMODE_READ);
1011 else if (CIFS_I(inode)->clientCanCacheRead == 0)
1012 break_lease(inode, FMODE_WRITE);
1013#endif
1014 rc = filemap_fdatawrite(inode->i_mapping);
1015 if (CIFS_I(inode)->clientCanCacheRead == 0) {
1016 waitrc = filemap_fdatawait(
1017 inode->i_mapping);
1018 invalidate_remote_inode(inode);
1019 }
1020 if (rc == 0)
1021 rc = waitrc;
1022 } else
1023 rc = 0;
1024 /* mutex_unlock(&inode->i_mutex);*/
1025 if (rc)
1026 CIFS_I(inode)->write_behind_rc = rc;
1027 cFYI(1, ("Oplock flush inode %p rc %d",
1028 inode, rc));
1029
1030 /* releasing stale oplock after recent reconnect
1031 of smb session using a now incorrect file
1032 handle is not a data integrity issue but do
1033 not bother sending an oplock release if session
1034 to server still is disconnected since oplock
1035 already released by the server in that case */
1036 if (!pTcon->need_reconnect) {
1037 rc = CIFSSMBLock(0, pTcon, netfid,
1038 0 /* len */ , 0 /* offset */, 0,
1039 0, LOCKING_ANDX_OPLOCK_RELEASE,
1040 false /* wait flag */);
1041 cFYI(1, ("Oplock release rc = %d", rc));
1042 }
1043 set_current_state(TASK_INTERRUPTIBLE);
1044 schedule_timeout(1); /* yield in case q were corrupt */
1045 }
1046 } while (!kthread_should_stop());
1047
1048 return 0;
1049}
1050
1051static int __init 972static int __init
1052init_cifs(void) 973init_cifs(void)
1053{ 974{
1054 int rc = 0; 975 int rc = 0;
1055 cifs_proc_init(); 976 cifs_proc_init();
1056 INIT_LIST_HEAD(&cifs_tcp_ses_list); 977 INIT_LIST_HEAD(&cifs_tcp_ses_list);
1057 INIT_LIST_HEAD(&cifs_oplock_list);
1058#ifdef CONFIG_CIFS_EXPERIMENTAL 978#ifdef CONFIG_CIFS_EXPERIMENTAL
1059 INIT_LIST_HEAD(&GlobalDnotifyReqList); 979 INIT_LIST_HEAD(&GlobalDnotifyReqList);
1060 INIT_LIST_HEAD(&GlobalDnotifyRsp_Q); 980 INIT_LIST_HEAD(&GlobalDnotifyRsp_Q);
@@ -1083,7 +1003,6 @@ init_cifs(void)
1083 rwlock_init(&GlobalSMBSeslock); 1003 rwlock_init(&GlobalSMBSeslock);
1084 rwlock_init(&cifs_tcp_ses_lock); 1004 rwlock_init(&cifs_tcp_ses_lock);
1085 spin_lock_init(&GlobalMid_Lock); 1005 spin_lock_init(&GlobalMid_Lock);
1086 spin_lock_init(&cifs_oplock_lock);
1087 1006
1088 if (cifs_max_pending < 2) { 1007 if (cifs_max_pending < 2) {
1089 cifs_max_pending = 2; 1008 cifs_max_pending = 2;
@@ -1118,16 +1037,13 @@ init_cifs(void)
1118 if (rc) 1037 if (rc)
1119 goto out_unregister_key_type; 1038 goto out_unregister_key_type;
1120#endif 1039#endif
1121 oplockThread = kthread_run(cifs_oplock_thread, NULL, "cifsoplockd"); 1040 rc = slow_work_register_user();
1122 if (IS_ERR(oplockThread)) { 1041 if (rc)
1123 rc = PTR_ERR(oplockThread); 1042 goto out_unregister_resolver_key;
1124 cERROR(1, ("error %d create oplock thread", rc));
1125 goto out_unregister_dfs_key_type;
1126 }
1127 1043
1128 return 0; 1044 return 0;
1129 1045
1130 out_unregister_dfs_key_type: 1046 out_unregister_resolver_key:
1131#ifdef CONFIG_CIFS_DFS_UPCALL 1047#ifdef CONFIG_CIFS_DFS_UPCALL
1132 unregister_key_type(&key_type_dns_resolver); 1048 unregister_key_type(&key_type_dns_resolver);
1133 out_unregister_key_type: 1049 out_unregister_key_type:
@@ -1164,7 +1080,6 @@ exit_cifs(void)
1164 cifs_destroy_inodecache(); 1080 cifs_destroy_inodecache();
1165 cifs_destroy_mids(); 1081 cifs_destroy_mids();
1166 cifs_destroy_request_bufs(); 1082 cifs_destroy_request_bufs();
1167 kthread_stop(oplockThread);
1168} 1083}
1169 1084
1170MODULE_AUTHOR("Steve French <sfrench@us.ibm.com>"); 1085MODULE_AUTHOR("Steve French <sfrench@us.ibm.com>");