From: Olaf Kirch <okir@suse.de>
To: nfs@lists.sourceforge.net, akpm@osdl.org
Subject: Re: [PATCH] NFS nolock broken in 2.6.9-rc4
Date: Fri, 15 Oct 2004 12:07:03 +0200 [thread overview]
Message-ID: <20041015100703.GA27307@suse.de> (raw)
In-Reply-To: <20041015095840.GA22992@suse.de>
[-- Attachment #1: Type: text/plain, Size: 626 bytes --]
On Fri, Oct 15, 2004 at 11:58:40AM +0200, Olaf Kirch wrote:
> I don't know why this change was made. The patch below simply reverts
> these two hunks; maybe there's a better solution involving LOCK_USE_CLNT
> the way it's used for F_GETLK at the moment.
I forgot to add the patch. Below there are two possible fixes.
fix1: just revert the changes
fix2: use LOCK_USE_CLNT for all locking operations if mounted nolock.
The second one is probably better...
Olaf
--
Olaf Kirch | Things that make Monday morning interesting, #1:
okir@suse.de | "I want to use NFS over AX25, can you help me?"
---------------+
[-- Attachment #2: nfs-nolock-fix1 --]
[-- Type: text/plain, Size: 929 bytes --]
Index: linux-2.6.9-rc4/fs/locks.c
===================================================================
--- linux-2.6.9-rc4.orig/fs/locks.c
+++ linux-2.6.9-rc4/fs/locks.c
@@ -1534,7 +1534,8 @@ int fcntl_setlk(struct file *filp, unsig
if (filp->f_op && filp->f_op->lock != NULL) {
error = filp->f_op->lock(filp, cmd, file_lock);
- goto out;
+ if (error < 0)
+ goto out;
}
for (;;) {
@@ -1668,7 +1669,8 @@ int fcntl_setlk64(struct file *filp, uns
if (filp->f_op && filp->f_op->lock != NULL) {
error = filp->f_op->lock(filp, cmd, file_lock);
- goto out;
+ if (error < 0)
+ goto out;
}
for (;;) {
@@ -1720,7 +1722,7 @@ void locks_remove_posix(struct file *fil
if (filp->f_op && filp->f_op->lock != NULL) {
filp->f_op->lock(filp, F_SETLK, &lock);
- goto out;
+ /* Ignore any error -- we must remove the locks anyway */
}
/* Can't use posix_lock_file here; we need to remove it no matter
[-- Attachment #3: nfs-nolock-fix2 --]
[-- Type: text/plain, Size: 1836 bytes --]
A previous change broke locking on NFS file systems mounted -o nolock.
This patch fixes the problem by making all NFS lock calls return
LOCK_USE_CLNT in this case, and treating it the way we did previously.
Signed-off-by: Olaf Kirch <okir@suse.de>
Index: linux-2.6.9-rc4/fs/locks.c
===================================================================
--- linux-2.6.9-rc4.orig/fs/locks.c
+++ linux-2.6.9-rc4/fs/locks.c
@@ -1534,7 +1534,8 @@ int fcntl_setlk(struct file *filp, unsig
if (filp->f_op && filp->f_op->lock != NULL) {
error = filp->f_op->lock(filp, cmd, file_lock);
- goto out;
+ if (error != LOCK_USE_CLNT)
+ goto out;
}
for (;;) {
@@ -1668,7 +1669,8 @@ int fcntl_setlk64(struct file *filp, uns
if (filp->f_op && filp->f_op->lock != NULL) {
error = filp->f_op->lock(filp, cmd, file_lock);
- goto out;
+ if (error != LOCK_USE_CLNT)
+ goto out;
}
for (;;) {
@@ -1719,8 +1721,9 @@ void locks_remove_posix(struct file *fil
lock.fl_lmops = NULL;
if (filp->f_op && filp->f_op->lock != NULL) {
- filp->f_op->lock(filp, F_SETLK, &lock);
- goto out;
+ error = filp->f_op->lock(filp, F_SETLK, &lock);
+ if (error != LOCK_USE_CLNT)
+ goto out;
}
/* Can't use posix_lock_file here; we need to remove it no matter
Index: linux-2.6.9-rc4/fs/nfs/file.c
===================================================================
--- linux-2.6.9-rc4.orig/fs/nfs/file.c
+++ linux-2.6.9-rc4/fs/nfs/file.c
@@ -397,11 +397,9 @@ nfs_lock(struct file *filp, int cmd, str
return -ENOLCK;
if (NFS_PROTO(inode)->version != 4) {
- /* Fake OK code if mounted without NLM support */
+ /* If mounted NONLM, tell VFS to use local locking only. */
if (NFS_SERVER(inode)->flags & NFS_MOUNT_NONLM) {
- if (IS_GETLK(cmd))
- return LOCK_USE_CLNT;
- return 0;
+ return LOCK_USE_CLNT;
}
}
next prev parent reply other threads:[~2004-10-15 10:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-15 9:58 [PATCH] NFS nolock broken in 2.6.9-rc4 Olaf Kirch
2004-10-15 10:07 ` Olaf Kirch [this message]
2004-10-15 14:46 ` Trond Myklebust
2004-10-15 15:11 ` Trond Myklebust
2004-10-15 15:13 ` Trond Myklebust
[not found] ` <20041016004957.38ccd273.akpm@osdl.org>
2004-10-18 7:39 ` Olaf Kirch
2004-10-15 14:44 ` Trond Myklebust
2004-10-15 15:12 ` Olaf Kirch
2004-10-15 15:21 ` Olaf Kirch
2004-10-15 16:47 ` Trond Myklebust
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20041015100703.GA27307@suse.de \
--to=okir@suse.de \
--cc=akpm@osdl.org \
--cc=nfs@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox