]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
afs: Avoid tracking file locks for RO volumes
authorAndrew Deason <adeason@sinenomine.net>
Tue, 2 Oct 2012 19:38:20 +0000 (14:38 -0500)
committerStephan Wiesand <stephan.wiesand@desy.de>
Wed, 28 Aug 2013 13:10:56 +0000 (06:10 -0700)
Advisory file locks for RO volumes don't make a lot of sense, since
there are no possible writes to worry about. The fileserver already
does not track these, so don't even bother processing them in the
client.

Reviewed-on: http://gerrit.openafs.org/8197
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
(cherry picked from commit 0fc27471e7da0c5de4addcdec1bfbca5208072cc)

Change-Id: I308d930c94708fd8d9025886c10f40cc4d10d195
Reviewed-on: http://gerrit.openafs.org/8910
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
src/afs/LINUX/osi_vnodeops.c
src/afs/VNOPS/afs_vnop_flock.c

index b91250ed5104fc727fcb2c8474f56c5a311545b7..2f6e5bdf6e5e446342625f632569337daebf9604 100644 (file)
@@ -588,6 +588,16 @@ afs_linux_lock(struct file *fp, int cmd, struct file_lock *flp)
 #endif /* F_GETLK64 && F_GETLK != F_GETLK64 */
 
     AFS_GLOCK();
+    if ((vcp->f.states & CRO)) {
+       if (flp->fl_type == F_WRLCK) {
+           code = EBADF;
+       } else {
+           code = 0;
+       }
+       AFS_GUNLOCK();
+       crfree(credp);
+       return code;
+    }
     code = afs_convert_code(afs_lockctl(vcp, &flock, cmd, credp));
     AFS_GUNLOCK();
 
index 33c679fef8c181d5bea50c99b80474dc7e72f64b..36d42bca874b56fa748d0e4b04e84c18a55d2830 100644 (file)
@@ -598,6 +598,18 @@ int afs_lockctl(struct vcache * avc, struct AFS_FLOCK * af, int acmd,
 #else
        ) {
 #endif
+
+    if ((avc->f.states & CRO)) {
+       /* for RO volumes, don't do anything for locks; the fileserver doesn't
+        * even track them. A write lock should not be possible, though. */
+       if (af->l_type == F_WRLCK) {
+           code = EBADF;
+       } else {
+           code = 0;
+       }
+       goto done;
+    }
+
     /* Java VMs ask for l_len=(long)-1 regardless of OS/CPU */
     if ((sizeof(af->l_len) == 8) && (af->l_len == 0x7fffffffffffffffLL))
        af->l_len = 0;