aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/link.c
diff options
context:
space:
mode:
authorPavel Shilovsky <piastry@etersoft.ru>2011-05-26 02:02:00 -0400
committerSteve French <sfrench@us.ibm.com>2011-05-26 23:57:16 -0400
commitd4ffff1fa9695c5b5c0bf337e208d8833b88ff2d (patch)
treeacd4b6cfa7962a1cee7e9c81f11bd9ccb0d3ff24 /fs/cifs/link.c
parent25c7f41e9234f60af30e086278f1de7974f8816f (diff)
CIFS: Add rwpidforward mount option
Add rwpidforward mount option that switches on a mode when we forward pid of a process who opened a file to any read and write operation. This can prevent applications like WINE from failing on read or write operation on a previously locked file region from the same netfd from another process if we use mandatory brlock style. It is actual for WINE because during a run of WINE program two processes work on the same netfd - share the same file struct between several VFS fds: 1) WINE-server does open and lock; 2) WINE-application does read and write. Signed-off-by: Pavel Shilovsky <piastry@etersoft.ru> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/link.c')
-rw-r--r--fs/cifs/link.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/fs/cifs/link.c b/fs/cifs/link.c
index 1a6a388cf5d8..4682d44b6f5b 100644
--- a/fs/cifs/link.c
+++ b/fs/cifs/link.c
@@ -235,6 +235,7 @@ CIFSQueryMFSymLink(const int xid, struct cifsTconInfo *tcon,
235 unsigned int bytes_read = 0; 235 unsigned int bytes_read = 0;
236 int buf_type = CIFS_NO_BUFFER; 236 int buf_type = CIFS_NO_BUFFER;
237 unsigned int link_len = 0; 237 unsigned int link_len = 0;
238 struct cifs_io_parms io_parms;
238 FILE_ALL_INFO file_info; 239 FILE_ALL_INFO file_info;
239 240
240 rc = CIFSSMBOpen(xid, tcon, searchName, FILE_OPEN, GENERIC_READ, 241 rc = CIFSSMBOpen(xid, tcon, searchName, FILE_OPEN, GENERIC_READ,
@@ -253,11 +254,13 @@ CIFSQueryMFSymLink(const int xid, struct cifsTconInfo *tcon,
253 if (!buf) 254 if (!buf)
254 return -ENOMEM; 255 return -ENOMEM;
255 pbuf = buf; 256 pbuf = buf;
257 io_parms.netfid = netfid;
258 io_parms.pid = current->tgid;
259 io_parms.tcon = tcon;
260 io_parms.offset = 0;
261 io_parms.length = CIFS_MF_SYMLINK_FILE_SIZE;
256 262
257 rc = CIFSSMBRead(xid, tcon, netfid, 263 rc = CIFSSMBRead(xid, &io_parms, &bytes_read, &pbuf, &buf_type);
258 CIFS_MF_SYMLINK_FILE_SIZE /* length */,
259 0 /* offset */,
260 &bytes_read, &pbuf, &buf_type);
261 CIFSSMBClose(xid, tcon, netfid); 264 CIFSSMBClose(xid, tcon, netfid);
262 if (rc != 0) { 265 if (rc != 0) {
263 kfree(buf); 266 kfree(buf);
@@ -296,6 +299,7 @@ CIFSCheckMFSymlink(struct cifs_fattr *fattr,
296 __u16 netfid = 0; 299 __u16 netfid = 0;
297 struct tcon_link *tlink; 300 struct tcon_link *tlink;
298 struct cifsTconInfo *pTcon; 301 struct cifsTconInfo *pTcon;
302 struct cifs_io_parms io_parms;
299 u8 *buf; 303 u8 *buf;
300 char *pbuf; 304 char *pbuf;
301 unsigned int bytes_read = 0; 305 unsigned int bytes_read = 0;
@@ -332,11 +336,13 @@ CIFSCheckMFSymlink(struct cifs_fattr *fattr,
332 goto out; 336 goto out;
333 } 337 }
334 pbuf = buf; 338 pbuf = buf;
339 io_parms.netfid = netfid;
340 io_parms.pid = current->tgid;
341 io_parms.tcon = pTcon;
342 io_parms.offset = 0;
343 io_parms.length = CIFS_MF_SYMLINK_FILE_SIZE;
335 344
336 rc = CIFSSMBRead(xid, pTcon, netfid, 345 rc = CIFSSMBRead(xid, &io_parms, &bytes_read, &pbuf, &buf_type);
337 CIFS_MF_SYMLINK_FILE_SIZE /* length */,
338 0 /* offset */,
339 &bytes_read, &pbuf, &buf_type);
340 CIFSSMBClose(xid, pTcon, netfid); 346 CIFSSMBClose(xid, pTcon, netfid);
341 if (rc != 0) { 347 if (rc != 0) {
342 kfree(buf); 348 kfree(buf);