diff options
author | Steve French <sfrench@us.ibm.com> | 2008-04-15 14:40:48 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2008-04-15 14:40:48 -0400 |
commit | 5d941ca628a142f44d7a2440fe919f8e8691f590 (patch) | |
tree | fb1028cc422187b2507f3830eac5dfc92c7eb29d /fs/cifs | |
parent | e48d199ba10bb8267f491a3a585ca4a833e950a4 (diff) |
[CIFS] Fix oops when slow oplock process races with unmount
If a tcon is being freed in call tconInfoFree, clean up any entries that may
exist in global oplock queue as the tcon structure hanging off of those entries
will be invalid and can cause oops while accesing any elements in the
tcon structure.
Signed-off-by: Shirish Pargaonkar <shirishp@us.ibm.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/cifsproto.h | 1 | ||||
-rw-r--r-- | fs/cifs/connect.c | 1 | ||||
-rw-r--r-- | fs/cifs/transport.c | 18 |
3 files changed, 20 insertions, 0 deletions
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index 7e5e0e78cd72..0c83da4a7dab 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h | |||
@@ -84,6 +84,7 @@ extern __u16 GetNextMid(struct TCP_Server_Info *server); | |||
84 | extern struct oplock_q_entry *AllocOplockQEntry(struct inode *, u16, | 84 | extern struct oplock_q_entry *AllocOplockQEntry(struct inode *, u16, |
85 | struct cifsTconInfo *); | 85 | struct cifsTconInfo *); |
86 | extern void DeleteOplockQEntry(struct oplock_q_entry *); | 86 | extern void DeleteOplockQEntry(struct oplock_q_entry *); |
87 | extern void DeleteTconOplockQEntries(struct cifsTconInfo *); | ||
87 | extern struct timespec cifs_NTtimeToUnix(u64 utc_nanoseconds_since_1601); | 88 | extern struct timespec cifs_NTtimeToUnix(u64 utc_nanoseconds_since_1601); |
88 | extern u64 cifs_UnixTimeToNT(struct timespec); | 89 | extern u64 cifs_UnixTimeToNT(struct timespec); |
89 | extern __le64 cnvrtDosCifsTm(__u16 date, __u16 time); | 90 | extern __le64 cnvrtDosCifsTm(__u16 date, __u16 time); |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 8dbfa97cd18c..e17106730168 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -3527,6 +3527,7 @@ cifs_umount(struct super_block *sb, struct cifs_sb_info *cifs_sb) | |||
3527 | FreeXid(xid); | 3527 | FreeXid(xid); |
3528 | return 0; | 3528 | return 0; |
3529 | } | 3529 | } |
3530 | DeleteTconOplockQEntries(cifs_sb->tcon); | ||
3530 | tconInfoFree(cifs_sb->tcon); | 3531 | tconInfoFree(cifs_sb->tcon); |
3531 | if ((ses) && (ses->server)) { | 3532 | if ((ses) && (ses->server)) { |
3532 | /* save off task so we do not refer to ses later */ | 3533 | /* save off task so we do not refer to ses later */ |
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index 3612d6c0a0bb..000ac509c98a 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c | |||
@@ -142,6 +142,24 @@ void DeleteOplockQEntry(struct oplock_q_entry *oplockEntry) | |||
142 | kmem_cache_free(cifs_oplock_cachep, oplockEntry); | 142 | kmem_cache_free(cifs_oplock_cachep, oplockEntry); |
143 | } | 143 | } |
144 | 144 | ||
145 | |||
146 | void DeleteTconOplockQEntries(struct cifsTconInfo *tcon) | ||
147 | { | ||
148 | struct oplock_q_entry *temp; | ||
149 | |||
150 | if (tcon == NULL) | ||
151 | return; | ||
152 | |||
153 | spin_lock(&GlobalMid_Lock); | ||
154 | list_for_each_entry(temp, &GlobalOplock_Q, qhead) { | ||
155 | if ((temp->tcon) && (temp->tcon == tcon)) { | ||
156 | list_del(&temp->qhead); | ||
157 | kmem_cache_free(cifs_oplock_cachep, temp); | ||
158 | } | ||
159 | } | ||
160 | spin_unlock(&GlobalMid_Lock); | ||
161 | } | ||
162 | |||
145 | int | 163 | int |
146 | smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer, | 164 | smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer, |
147 | unsigned int smb_buf_length, struct sockaddr *sin) | 165 | unsigned int smb_buf_length, struct sockaddr *sin) |