Skip to content

Commit 8d4ab5d

Browse files
committed
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: when renaming don't try to unlink negative dentry cifs: remove unneeded bcc_ptr update in CIFSTCon cifs: add cFYI messages with some of the saved strings from ssetup/tcon cifs: fix buffer size for tcon->nativeFileSystem field cifs: fix unicode string area word alignment in session setup [CIFS] Fix build break caused by change to new current_umask helper function [CIFS] Fix sparse warnings [CIFS] Add support for posix open during lookup cifs: no need to use rcu_assign_pointer on immutable keys cifs: remove dnotify thread code [CIFS] remove some build warnings cifs: vary timeout on writes past EOF based on offset (try #5) [CIFS] Fix build break from recent DFS patch when DFS support not enabled Remote DFS root support. [CIFS] Endian convert UniqueId when reporting inode numbers from server files cifs: remove some pointless conditionals before kfree() cifs: flush data on any setattr
2 parents df89f1b + fc6f394 commit 8d4ab5d

File tree

13 files changed

+407
-272
lines changed

13 files changed

+407
-272
lines changed

fs/cifs/CHANGES

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ Posix file open support added (turned off after one attempt if server
1515
fails to support it properly, as with Samba server versions prior to 3.3.2)
1616
Fix "redzone overwritten" bug in cifs_put_tcon (CIFSTcon may allocate too
1717
little memory for the "nativeFileSystem" field returned by the server
18-
during mount).
18+
during mount). Endian convert inode numbers if necessary (makes it easier
19+
to compare inode numbers on network files from big endian systems).
1920

2021
Version 1.56
2122
------------

fs/cifs/cifs_spnego.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ cifs_spnego_key_instantiate(struct key *key, const void *data, size_t datalen)
4141

4242
/* attach the data */
4343
memcpy(payload, data, datalen);
44-
rcu_assign_pointer(key->payload.data, payload);
44+
key->payload.data = payload;
4545
ret = 0;
4646

4747
error:

fs/cifs/cifsfs.c

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ unsigned int sign_CIFS_PDUs = 1;
6666
extern struct task_struct *oplockThread; /* remove sparse warning */
6767
struct task_struct *oplockThread = NULL;
6868
/* extern struct task_struct * dnotifyThread; remove sparse warning */
69-
#ifdef CONFIG_CIFS_EXPERIMENTAL
70-
static struct task_struct *dnotifyThread = NULL;
71-
#endif
7269
static const struct super_operations cifs_super_ops;
7370
unsigned int CIFSMaxBufSize = CIFS_MAX_MSGSIZE;
7471
module_param(CIFSMaxBufSize, int, 0);
@@ -316,6 +313,7 @@ cifs_alloc_inode(struct super_block *sb)
316313
cifs_inode->clientCanCacheAll = false;
317314
cifs_inode->delete_pending = false;
318315
cifs_inode->vfs_inode.i_blkbits = 14; /* 2**14 = CIFS_MAX_MSGSIZE */
316+
cifs_inode->server_eof = 0;
319317

320318
/* Can not set i_flags here - they get immediately overwritten
321319
to zero by the VFS */
@@ -1040,34 +1038,6 @@ static int cifs_oplock_thread(void *dummyarg)
10401038
return 0;
10411039
}
10421040

1043-
#ifdef CONFIG_CIFS_EXPERIMENTAL
1044-
static int cifs_dnotify_thread(void *dummyarg)
1045-
{
1046-
struct list_head *tmp;
1047-
struct TCP_Server_Info *server;
1048-
1049-
do {
1050-
if (try_to_freeze())
1051-
continue;
1052-
set_current_state(TASK_INTERRUPTIBLE);
1053-
schedule_timeout(15*HZ);
1054-
/* check if any stuck requests that need
1055-
to be woken up and wakeq so the
1056-
thread can wake up and error out */
1057-
read_lock(&cifs_tcp_ses_lock);
1058-
list_for_each(tmp, &cifs_tcp_ses_list) {
1059-
server = list_entry(tmp, struct TCP_Server_Info,
1060-
tcp_ses_list);
1061-
if (atomic_read(&server->inFlight))
1062-
wake_up_all(&server->response_q);
1063-
}
1064-
read_unlock(&cifs_tcp_ses_lock);
1065-
} while (!kthread_should_stop());
1066-
1067-
return 0;
1068-
}
1069-
#endif
1070-
10711041
static int __init
10721042
init_cifs(void)
10731043
{
@@ -1144,21 +1114,8 @@ init_cifs(void)
11441114
goto out_unregister_dfs_key_type;
11451115
}
11461116

1147-
#ifdef CONFIG_CIFS_EXPERIMENTAL
1148-
dnotifyThread = kthread_run(cifs_dnotify_thread, NULL, "cifsdnotifyd");
1149-
if (IS_ERR(dnotifyThread)) {
1150-
rc = PTR_ERR(dnotifyThread);
1151-
cERROR(1, ("error %d create dnotify thread", rc));
1152-
goto out_stop_oplock_thread;
1153-
}
1154-
#endif
1155-
11561117
return 0;
11571118

1158-
#ifdef CONFIG_CIFS_EXPERIMENTAL
1159-
out_stop_oplock_thread:
1160-
#endif
1161-
kthread_stop(oplockThread);
11621119
out_unregister_dfs_key_type:
11631120
#ifdef CONFIG_CIFS_DFS_UPCALL
11641121
unregister_key_type(&key_type_dns_resolver);
@@ -1196,9 +1153,6 @@ exit_cifs(void)
11961153
cifs_destroy_inodecache();
11971154
cifs_destroy_mids();
11981155
cifs_destroy_request_bufs();
1199-
#ifdef CONFIG_CIFS_EXPERIMENTAL
1200-
kthread_stop(dnotifyThread);
1201-
#endif
12021156
kthread_stop(oplockThread);
12031157
}
12041158

fs/cifs/cifsglob.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ struct cifsFileInfo {
350350
bool invalidHandle:1; /* file closed via session abend */
351351
bool messageMode:1; /* for pipes: message vs byte mode */
352352
atomic_t wrtPending; /* handle in use - defer close */
353-
struct semaphore fh_sem; /* prevents reopen race after dead ses*/
353+
struct mutex fh_mutex; /* prevents reopen race after dead ses*/
354354
struct cifs_search_info srch_inf;
355355
};
356356

@@ -370,6 +370,7 @@ struct cifsInodeInfo {
370370
bool clientCanCacheAll:1; /* read and writebehind oplock */
371371
bool oplockPending:1;
372372
bool delete_pending:1; /* DELETE_ON_CLOSE is set */
373+
u64 server_eof; /* current file size on server */
373374
struct inode vfs_inode;
374375
};
375376

fs/cifs/cifspdu.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2163,7 +2163,7 @@ typedef struct {
21632163
__le32 Type;
21642164
__le64 DevMajor;
21652165
__le64 DevMinor;
2166-
__u64 UniqueId;
2166+
__le64 UniqueId;
21672167
__le64 Permissions;
21682168
__le64 Nlinks;
21692169
} __attribute__((packed)) FILE_UNIX_BASIC_INFO; /* level 0x200 QPathInfo */
@@ -2308,7 +2308,7 @@ struct unlink_psx_rq { /* level 0x20a SetPathInfo */
23082308
} __attribute__((packed));
23092309

23102310
struct file_internal_info {
2311-
__u64 UniqueId; /* inode number */
2311+
__le64 UniqueId; /* inode number */
23122312
} __attribute__((packed)); /* level 0x3ee */
23132313

23142314
struct file_mode_info {
@@ -2338,7 +2338,7 @@ typedef struct {
23382338
__le32 Type;
23392339
__le64 DevMajor;
23402340
__le64 DevMinor;
2341-
__u64 UniqueId;
2341+
__le64 UniqueId;
23422342
__le64 Permissions;
23432343
__le64 Nlinks;
23442344
char FileName[1];
@@ -2386,7 +2386,7 @@ typedef struct {
23862386
__le32 FileNameLength;
23872387
__le32 EaSize; /* EA size */
23882388
__le32 Reserved;
2389-
__u64 UniqueId; /* inode num - le since Samba puts ino in low 32 bit*/
2389+
__le64 UniqueId; /* inode num - le since Samba puts ino in low 32 bit*/
23902390
char FileName[1];
23912391
} __attribute__((packed)) SEARCH_ID_FULL_DIR_INFO; /* level 0x105 FF rsp data */
23922392

fs/cifs/cifssmb.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,6 +1626,8 @@ CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon,
16261626
int smb_hdr_len;
16271627
int resp_buf_type = 0;
16281628

1629+
*nbytes = 0;
1630+
16291631
cFYI(1, ("write2 at %lld %d bytes", (long long)offset, count));
16301632

16311633
if (tcon->ses->capabilities & CAP_LARGE_FILES) {
@@ -1682,11 +1684,9 @@ CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon,
16821684
cifs_stats_inc(&tcon->num_writes);
16831685
if (rc) {
16841686
cFYI(1, ("Send error Write2 = %d", rc));
1685-
*nbytes = 0;
16861687
} else if (resp_buf_type == 0) {
16871688
/* presumably this can not happen, but best to be safe */
16881689
rc = -EIO;
1689-
*nbytes = 0;
16901690
} else {
16911691
WRITE_RSP *pSMBr = (WRITE_RSP *)iov[0].iov_base;
16921692
*nbytes = le16_to_cpu(pSMBr->CountHigh);
@@ -3918,7 +3918,7 @@ CIFSGetSrvInodeNumber(const int xid, struct cifsTconInfo *tcon,
39183918
}
39193919
pfinfo = (struct file_internal_info *)
39203920
(data_offset + (char *) &pSMBr->hdr.Protocol);
3921-
*inode_number = pfinfo->UniqueId;
3921+
*inode_number = le64_to_cpu(pfinfo->UniqueId);
39223922
}
39233923
}
39243924
GetInodeNumOut:

0 commit comments

Comments
 (0)