|
@@ -644,10 +644,10 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
|
|
__u64 length;
|
|
__u64 length;
|
|
bool wait_flag = false;
|
|
bool wait_flag = false;
|
|
struct cifs_sb_info *cifs_sb;
|
|
struct cifs_sb_info *cifs_sb;
|
|
- struct cifsTconInfo *pTcon;
|
|
|
|
|
|
+ struct cifsTconInfo *tcon;
|
|
__u16 netfid;
|
|
__u16 netfid;
|
|
__u8 lockType = LOCKING_ANDX_LARGE_FILES;
|
|
__u8 lockType = LOCKING_ANDX_LARGE_FILES;
|
|
- bool posix_locking;
|
|
|
|
|
|
+ bool posix_locking = 0;
|
|
|
|
|
|
length = 1 + pfLock->fl_end - pfLock->fl_start;
|
|
length = 1 + pfLock->fl_end - pfLock->fl_start;
|
|
rc = -EACCES;
|
|
rc = -EACCES;
|
|
@@ -698,7 +698,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
|
|
cFYI(1, ("Unknown type of lock"));
|
|
cFYI(1, ("Unknown type of lock"));
|
|
|
|
|
|
cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
|
|
cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
|
|
- pTcon = cifs_sb->tcon;
|
|
|
|
|
|
+ tcon = cifs_sb->tcon;
|
|
|
|
|
|
if (file->private_data == NULL) {
|
|
if (file->private_data == NULL) {
|
|
FreeXid(xid);
|
|
FreeXid(xid);
|
|
@@ -706,9 +706,10 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
|
|
}
|
|
}
|
|
netfid = ((struct cifsFileInfo *)file->private_data)->netfid;
|
|
netfid = ((struct cifsFileInfo *)file->private_data)->netfid;
|
|
|
|
|
|
- posix_locking = (cifs_sb->tcon->ses->capabilities & CAP_UNIX) &&
|
|
|
|
- (CIFS_UNIX_FCNTL_CAP & le64_to_cpu(cifs_sb->tcon->fsUnixInfo.Capability));
|
|
|
|
-
|
|
|
|
|
|
+ if ((tcon->ses->capabilities & CAP_UNIX) &&
|
|
|
|
+ (CIFS_UNIX_FCNTL_CAP & le64_to_cpu(tcon->fsUnixInfo.Capability)) &&
|
|
|
|
+ (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOPOSIXBRL == 0))
|
|
|
|
+ posix_locking = 1;
|
|
/* BB add code here to normalize offset and length to
|
|
/* BB add code here to normalize offset and length to
|
|
account for negative length which we can not accept over the
|
|
account for negative length which we can not accept over the
|
|
wire */
|
|
wire */
|
|
@@ -719,7 +720,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
|
|
posix_lock_type = CIFS_RDLCK;
|
|
posix_lock_type = CIFS_RDLCK;
|
|
else
|
|
else
|
|
posix_lock_type = CIFS_WRLCK;
|
|
posix_lock_type = CIFS_WRLCK;
|
|
- rc = CIFSSMBPosixLock(xid, pTcon, netfid, 1 /* get */,
|
|
|
|
|
|
+ rc = CIFSSMBPosixLock(xid, tcon, netfid, 1 /* get */,
|
|
length, pfLock,
|
|
length, pfLock,
|
|
posix_lock_type, wait_flag);
|
|
posix_lock_type, wait_flag);
|
|
FreeXid(xid);
|
|
FreeXid(xid);
|
|
@@ -727,10 +728,10 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
|
|
}
|
|
}
|
|
|
|
|
|
/* BB we could chain these into one lock request BB */
|
|
/* BB we could chain these into one lock request BB */
|
|
- rc = CIFSSMBLock(xid, pTcon, netfid, length, pfLock->fl_start,
|
|
|
|
|
|
+ rc = CIFSSMBLock(xid, tcon, netfid, length, pfLock->fl_start,
|
|
0, 1, lockType, 0 /* wait flag */ );
|
|
0, 1, lockType, 0 /* wait flag */ );
|
|
if (rc == 0) {
|
|
if (rc == 0) {
|
|
- rc = CIFSSMBLock(xid, pTcon, netfid, length,
|
|
|
|
|
|
+ rc = CIFSSMBLock(xid, tcon, netfid, length,
|
|
pfLock->fl_start, 1 /* numUnlock */ ,
|
|
pfLock->fl_start, 1 /* numUnlock */ ,
|
|
0 /* numLock */ , lockType,
|
|
0 /* numLock */ , lockType,
|
|
0 /* wait flag */ );
|
|
0 /* wait flag */ );
|
|
@@ -767,7 +768,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
|
|
if (numUnlock == 1)
|
|
if (numUnlock == 1)
|
|
posix_lock_type = CIFS_UNLCK;
|
|
posix_lock_type = CIFS_UNLCK;
|
|
|
|
|
|
- rc = CIFSSMBPosixLock(xid, pTcon, netfid, 0 /* set */,
|
|
|
|
|
|
+ rc = CIFSSMBPosixLock(xid, tcon, netfid, 0 /* set */,
|
|
length, pfLock,
|
|
length, pfLock,
|
|
posix_lock_type, wait_flag);
|
|
posix_lock_type, wait_flag);
|
|
} else {
|
|
} else {
|
|
@@ -775,7 +776,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
|
|
(struct cifsFileInfo *)file->private_data;
|
|
(struct cifsFileInfo *)file->private_data;
|
|
|
|
|
|
if (numLock) {
|
|
if (numLock) {
|
|
- rc = CIFSSMBLock(xid, pTcon, netfid, length,
|
|
|
|
|
|
+ rc = CIFSSMBLock(xid, tcon, netfid, length,
|
|
pfLock->fl_start,
|
|
pfLock->fl_start,
|
|
0, numLock, lockType, wait_flag);
|
|
0, numLock, lockType, wait_flag);
|
|
|
|
|
|
@@ -796,7 +797,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
|
|
if (pfLock->fl_start <= li->offset &&
|
|
if (pfLock->fl_start <= li->offset &&
|
|
(pfLock->fl_start + length) >=
|
|
(pfLock->fl_start + length) >=
|
|
(li->offset + li->length)) {
|
|
(li->offset + li->length)) {
|
|
- stored_rc = CIFSSMBLock(xid, pTcon,
|
|
|
|
|
|
+ stored_rc = CIFSSMBLock(xid, tcon,
|
|
netfid,
|
|
netfid,
|
|
li->length, li->offset,
|
|
li->length, li->offset,
|
|
1, 0, li->type, false);
|
|
1, 0, li->type, false);
|