aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifssmb.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2012-07-23 13:28:37 -0400
committerSteve French <smfrench@gmail.com>2012-07-23 17:36:29 -0400
commitc5fd363d771393a7b42bbbe051f30f97d4867a40 (patch)
tree338135e4be3a6f12a7c1350655cfc48b1db52457 /fs/cifs/cifssmb.c
parentac3aa2f8ae29c186c4742d15e39712af417c6d68 (diff)
cifs: move file_lock off stack in cifs_push_posix_locks
struct file_lock is pretty large, so we really don't want that on the stack in a potentially long call chain. Reorganize the arguments to CIFSSMBPosixLock to eliminate the need for that. Eliminate the get_flag and simply use a non-NULL pLockInfo to indicate that this is a "get" operation. In order to do that, need to add a new loff_t argument for the start_offset. Reported-by: Al Viro <viro@ZenIV.linux.org.uk> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/cifssmb.c')
-rw-r--r--fs/cifs/cifssmb.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 684a0723021f..5659850f780a 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -2356,9 +2356,10 @@ CIFSSMBLock(const int xid, struct cifs_tcon *tcon,
2356 2356
2357int 2357int
2358CIFSSMBPosixLock(const int xid, struct cifs_tcon *tcon, 2358CIFSSMBPosixLock(const int xid, struct cifs_tcon *tcon,
2359 const __u16 smb_file_id, const __u32 netpid, const int get_flag, 2359 const __u16 smb_file_id, const __u32 netpid,
2360 const __u64 len, struct file_lock *pLockData, 2360 const loff_t start_offset, const __u64 len,
2361 const __u16 lock_type, const bool waitFlag) 2361 struct file_lock *pLockData, const __u16 lock_type,
2362 const bool waitFlag)
2362{ 2363{
2363 struct smb_com_transaction2_sfi_req *pSMB = NULL; 2364 struct smb_com_transaction2_sfi_req *pSMB = NULL;
2364 struct smb_com_transaction2_sfi_rsp *pSMBr = NULL; 2365 struct smb_com_transaction2_sfi_rsp *pSMBr = NULL;
@@ -2372,9 +2373,6 @@ CIFSSMBPosixLock(const int xid, struct cifs_tcon *tcon,
2372 2373
2373 cFYI(1, "Posix Lock"); 2374 cFYI(1, "Posix Lock");
2374 2375
2375 if (pLockData == NULL)
2376 return -EINVAL;
2377
2378 rc = small_smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB); 2376 rc = small_smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB);
2379 2377
2380 if (rc) 2378 if (rc)
@@ -2395,7 +2393,7 @@ CIFSSMBPosixLock(const int xid, struct cifs_tcon *tcon,
2395 pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB from sess */ 2393 pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB from sess */
2396 pSMB->SetupCount = 1; 2394 pSMB->SetupCount = 1;
2397 pSMB->Reserved3 = 0; 2395 pSMB->Reserved3 = 0;
2398 if (get_flag) 2396 if (pLockData)
2399 pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FILE_INFORMATION); 2397 pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FILE_INFORMATION);
2400 else 2398 else
2401 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION); 2399 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION);
@@ -2417,7 +2415,7 @@ CIFSSMBPosixLock(const int xid, struct cifs_tcon *tcon,
2417 pSMB->Timeout = 0; 2415 pSMB->Timeout = 0;
2418 2416
2419 parm_data->pid = cpu_to_le32(netpid); 2417 parm_data->pid = cpu_to_le32(netpid);
2420 parm_data->start = cpu_to_le64(pLockData->fl_start); 2418 parm_data->start = cpu_to_le64(start_offset);
2421 parm_data->length = cpu_to_le64(len); /* normalize negative numbers */ 2419 parm_data->length = cpu_to_le64(len); /* normalize negative numbers */
2422 2420
2423 pSMB->DataOffset = cpu_to_le16(offset); 2421 pSMB->DataOffset = cpu_to_le16(offset);
@@ -2441,7 +2439,7 @@ CIFSSMBPosixLock(const int xid, struct cifs_tcon *tcon,
2441 2439
2442 if (rc) { 2440 if (rc) {
2443 cFYI(1, "Send error in Posix Lock = %d", rc); 2441 cFYI(1, "Send error in Posix Lock = %d", rc);
2444 } else if (get_flag) { 2442 } else if (pLockData) {
2445 /* lock structure can be returned on get */ 2443 /* lock structure can be returned on get */
2446 __u16 data_offset; 2444 __u16 data_offset;
2447 __u16 data_count; 2445 __u16 data_count;