hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/fs/cifs/smb2file.c
....@@ -62,19 +62,20 @@
6262 smb2_oplock = SMB2_OPLOCK_LEVEL_BATCH;
6363
6464 rc = SMB2_open(xid, oparms, smb2_path, &smb2_oplock, smb2_data, NULL,
65
- NULL);
65
+ NULL, NULL);
6666 if (rc)
6767 goto out;
6868
6969
7070 if (oparms->tcon->use_resilient) {
71
- nr_ioctl_req.Timeout = 0; /* use server default (120 seconds) */
71
+ /* default timeout is 0, servers pick default (120 seconds) */
72
+ nr_ioctl_req.Timeout =
73
+ cpu_to_le32(oparms->tcon->handle_timeout);
7274 nr_ioctl_req.Reserved = 0;
7375 rc = SMB2_ioctl(xid, oparms->tcon, fid->persistent_fid,
7476 fid->volatile_fid, FSCTL_LMR_REQUEST_RESILIENCY,
75
- true /* is_fsctl */,
7677 (char *)&nr_ioctl_req, sizeof(nr_ioctl_req),
77
- NULL, NULL /* no return info */);
78
+ CIFSMaxBufSize, NULL, NULL /* no return info */);
7879 if (rc == -EOPNOTSUPP) {
7980 cifs_dbg(VFS,
8081 "resiliency not supported by server, disabling\n");
....@@ -86,14 +87,20 @@
8687 }
8788
8889 if (buf) {
89
- /* open response does not have IndexNumber field - get it */
90
- rc = SMB2_get_srv_num(xid, oparms->tcon, fid->persistent_fid,
90
+ /* if open response does not have IndexNumber field - get it */
91
+ if (smb2_data->IndexNumber == 0) {
92
+ rc = SMB2_get_srv_num(xid, oparms->tcon,
93
+ fid->persistent_fid,
9194 fid->volatile_fid,
9295 &smb2_data->IndexNumber);
93
- if (rc) {
94
- /* let get_inode_info disable server inode numbers */
95
- smb2_data->IndexNumber = 0;
96
- rc = 0;
96
+ if (rc) {
97
+ /*
98
+ * let get_inode_info disable server inode
99
+ * numbers
100
+ */
101
+ smb2_data->IndexNumber = 0;
102
+ rc = 0;
103
+ }
97104 }
98105 move_smb2_info_to_cifs(buf, smb2_data);
99106 }
....@@ -144,7 +151,12 @@
144151 (li->offset + li->length))
145152 continue;
146153 if (current->tgid != li->pid)
147
- continue;
154
+ /*
155
+ * flock and OFD lock are associated with an open
156
+ * file description, not the process.
157
+ */
158
+ if (!(flock->fl_flags & (FL_FLOCK | FL_OFDLCK)))
159
+ continue;
148160 if (cinode->can_cache_brlcks) {
149161 /*
150162 * We can cache brlock requests - simply remove a lock