Skip to content

Commit d9773ce

Browse files
committed
Merge branch 'for-linus' of git://git.samba.org/sfrench/cifs-2.6
Pull cifs/smb3 fixes from Steve French: "Fixes for problems found during testing and debugging at the SMB3 storage test event (plugfest) this week" * 'for-linus' of git://git.samba.org/sfrench/cifs-2.6: Fix mfsymlinks file size check Update version number displayed by modinfo for cifs.ko cifs: remove dead code Revert "cifs: No need to send SIGKILL to demux_thread during umount" [SMB3] Fix oops when creating symlinks on smb3 [CIFS] Fix setting time before epoch (negative time values)
2 parents 33d31d3 + 364d429 commit d9773ce

5 files changed

Lines changed: 45 additions & 25 deletions

File tree

‎fs/cifs/cifsfs.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,5 +136,5 @@ extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg);
136136
extern const struct export_operations cifs_export_ops;
137137
#endif /* CONFIG_CIFS_NFSD_EXPORT */
138138

139-
#define CIFS_VERSION "2.04"
139+
#define CIFS_VERSION "2.05"
140140
#endif /* _CIFSFS_H */

‎fs/cifs/connect.c‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,7 @@ cifs_demultiplex_thread(void *p)
837837
struct TCP_Server_Info *server = p;
838838
unsigned int pdu_length;
839839
char *buf = NULL;
840+
struct task_struct *task_to_wake = NULL;
840841
struct mid_q_entry *mid_entry;
841842

842843
current->flags |= PF_MEMALLOC;
@@ -927,7 +928,19 @@ cifs_demultiplex_thread(void *p)
927928
if (server->smallbuf) /* no sense logging a debug message if NULL */
928929
cifs_small_buf_release(server->smallbuf);
929930

931+
task_to_wake = xchg(&server->tsk, NULL);
930932
clean_demultiplex_info(server);
933+
934+
/* if server->tsk was NULL then wait for a signal before exiting */
935+
if (!task_to_wake) {
936+
set_current_state(TASK_INTERRUPTIBLE);
937+
while (!signal_pending(current)) {
938+
schedule();
939+
set_current_state(TASK_INTERRUPTIBLE);
940+
}
941+
set_current_state(TASK_RUNNING);
942+
}
943+
931944
module_put_and_exit(0);
932945
}
933946

@@ -2050,6 +2063,8 @@ cifs_find_tcp_session(struct smb_vol *vol)
20502063
static void
20512064
cifs_put_tcp_session(struct TCP_Server_Info *server)
20522065
{
2066+
struct task_struct *task;
2067+
20532068
spin_lock(&cifs_tcp_ses_lock);
20542069
if (--server->srv_count > 0) {
20552070
spin_unlock(&cifs_tcp_ses_lock);
@@ -2073,6 +2088,10 @@ cifs_put_tcp_session(struct TCP_Server_Info *server)
20732088
kfree(server->session_key.response);
20742089
server->session_key.response = NULL;
20752090
server->session_key.len = 0;
2091+
2092+
task = xchg(&server->tsk, NULL);
2093+
if (task)
2094+
force_sig(SIGKILL, task);
20762095
}
20772096

20782097
static struct TCP_Server_Info *

‎fs/cifs/link.c‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,12 @@ create_mf_symlink(const unsigned int xid, struct cifs_tcon *tcon,
213213
if (rc)
214214
goto out;
215215

216-
rc = tcon->ses->server->ops->create_mf_symlink(xid, tcon, cifs_sb,
217-
fromName, buf, &bytes_written);
216+
if (tcon->ses->server->ops->create_mf_symlink)
217+
rc = tcon->ses->server->ops->create_mf_symlink(xid, tcon,
218+
cifs_sb, fromName, buf, &bytes_written);
219+
else
220+
rc = -EOPNOTSUPP;
221+
218222
if (rc)
219223
goto out;
220224

@@ -339,9 +343,11 @@ cifs_query_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
339343
if (rc)
340344
return rc;
341345

342-
if (file_info.EndOfFile != cpu_to_le64(CIFS_MF_SYMLINK_FILE_SIZE))
346+
if (file_info.EndOfFile != cpu_to_le64(CIFS_MF_SYMLINK_FILE_SIZE)) {
347+
rc = -ENOENT;
343348
/* it's not a symlink */
344349
goto out;
350+
}
345351

346352
io_parms.netfid = fid.netfid;
347353
io_parms.pid = current->tgid;

‎fs/cifs/netmisc.c‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -925,11 +925,23 @@ cifs_NTtimeToUnix(__le64 ntutc)
925925
/* BB what about the timezone? BB */
926926

927927
/* Subtract the NTFS time offset, then convert to 1s intervals. */
928-
u64 t;
928+
s64 t = le64_to_cpu(ntutc) - NTFS_TIME_OFFSET;
929+
930+
/*
931+
* Unfortunately can not use normal 64 bit division on 32 bit arch, but
932+
* the alternative, do_div, does not work with negative numbers so have
933+
* to special case them
934+
*/
935+
if (t < 0) {
936+
t = -t;
937+
ts.tv_nsec = (long)(do_div(t, 10000000) * 100);
938+
ts.tv_nsec = -ts.tv_nsec;
939+
ts.tv_sec = -t;
940+
} else {
941+
ts.tv_nsec = (long)do_div(t, 10000000) * 100;
942+
ts.tv_sec = t;
943+
}
929944

930-
t = le64_to_cpu(ntutc) - NTFS_TIME_OFFSET;
931-
ts.tv_nsec = do_div(t, 10000000) * 100;
932-
ts.tv_sec = t;
933945
return ts;
934946
}
935947

‎fs/cifs/sess.c‎

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -745,14 +745,6 @@ sess_auth_lanman(struct sess_data *sess_data)
745745
sess_free_buffer(sess_data);
746746
}
747747

748-
#else
749-
750-
static void
751-
sess_auth_lanman(struct sess_data *sess_data)
752-
{
753-
sess_data->result = -EOPNOTSUPP;
754-
sess_data->func = NULL;
755-
}
756748
#endif
757749

758750
static void
@@ -1103,15 +1095,6 @@ sess_auth_kerberos(struct sess_data *sess_data)
11031095
ses->auth_key.response = NULL;
11041096
}
11051097

1106-
#else
1107-
1108-
static void
1109-
sess_auth_kerberos(struct sess_data *sess_data)
1110-
{
1111-
cifs_dbg(VFS, "Kerberos negotiated but upcall support disabled!\n");
1112-
sess_data->result = -ENOSYS;
1113-
sess_data->func = NULL;
1114-
}
11151098
#endif /* ! CONFIG_CIFS_UPCALL */
11161099

11171100
/*

0 commit comments

Comments
 (0)