linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miklos Szeredi <miklos@szeredi.hu>
To: akpm@linux-foundation.org
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [patch 9/9] fuse: lockd support
Date: Fri, 09 May 2008 14:41:16 +0200	[thread overview]
Message-ID: <20080509124139.816149035@szeredi.hu> (raw)
In-Reply-To: 20080509124107.645600519@szeredi.hu

[-- Attachment #1: fuse_async_lock.patch --]
[-- Type: text/plain, Size: 1613 bytes --]

From: Miklos Szeredi <mszeredi@suse.cz>

If fuse filesystem doesn't define it's own lock operations, then allow
the lock manager to work with fuse.

Adding lockd support for remote locking is also possible, but more
difficult, because of the need handle lock cancellation.  It's also
rarely used, so leave it till later.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
---
 fs/fuse/file.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

Index: linux-2.6/fs/fuse/file.c
===================================================================
--- linux-2.6.orig/fs/fuse/file.c	2008-05-09 14:04:45.000000000 +0200
+++ linux-2.6/fs/fuse/file.c	2008-05-09 14:04:52.000000000 +0200
@@ -1341,6 +1341,11 @@ static int fuse_setlk(struct file *file,
 	pid_t pid = fl->fl_type != F_UNLCK ? current->tgid : 0;
 	int err;
 
+	if (fl->fl_lmops && fl->fl_lmops->fl_grant) {
+		/* NLM needs asynchronous locks, which we don't support yet */
+		return -ENOLCK;
+	}
+
 	/* Unlock on close is handled by the flush method */
 	if (fl->fl_flags & FL_CLOSE)
 		return 0;
@@ -1365,7 +1370,9 @@ static int fuse_file_lock(struct file *f
 	struct fuse_conn *fc = get_fuse_conn(inode);
 	int err;
 
-	if (cmd == F_GETLK) {
+	if (cmd == F_CANCELLK) {
+		err = 0;
+	} else if (cmd == F_GETLK) {
 		if (fc->no_lock) {
 			posix_test_lock(file, fl);
 			err = 0;
@@ -1373,7 +1380,7 @@ static int fuse_file_lock(struct file *f
 			err = fuse_getlk(file, fl);
 	} else {
 		if (fc->no_lock)
-			err = posix_lock_file_wait(file, fl);
+			err = posix_lock_file(file, fl, NULL);
 		else
 			err = fuse_setlk(file, fl, 0);
 	}

--

  parent reply	other threads:[~2008-05-09 12:41 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-09 12:41 [patch 0/9] file locking fixes + fuse nfs export support Miklos Szeredi
2008-05-09 12:41 ` [patch 1/9] lockd: dont return EAGAIN from blocking lock request Miklos Szeredi
2008-05-09 18:11   ` J. Bruce Fields
2008-05-09 18:30     ` Miklos Szeredi
2008-05-09 12:41 ` [patch 2/9] locks: add special return value for asynchronous locks Miklos Szeredi
2008-05-09 12:41 ` [patch 3/9] locks: cleanup code duplication Miklos Szeredi
2008-05-09 12:41 ` [patch 4/9] locks: allow ->lock() to return FILE_LOCK_DEFERRED Miklos Szeredi
2008-05-09 12:41 ` [patch 5/9] fuse: prepare lookup for nfs export Miklos Szeredi
2008-05-09 12:41 ` [patch 6/9] fuse: add export operations Miklos Szeredi
2008-05-09 19:40   ` Christoph Hellwig
2008-05-09 19:46     ` Christoph Hellwig
2008-05-13  8:34       ` Miklos Szeredi
2008-05-13  9:01         ` Christoph Hellwig
2008-05-15 13:07       ` Miklos Szeredi
2008-05-15 14:13         ` Christoph Hellwig
2008-05-09 20:02     ` Erez Zadok
2008-05-13  8:27       ` Miklos Szeredi
2008-05-09 12:41 ` [patch 7/9] fuse: add fuse_lookup_name() helper Miklos Szeredi
2008-05-09 12:41 ` [patch 8/9] fuse: nfs export special lookups Miklos Szeredi
2008-05-09 12:41 ` Miklos Szeredi [this message]
2008-05-09 15:50 ` [patch 0/9] file locking fixes + fuse nfs export support J. Bruce Fields
2008-05-09 15:58   ` Miklos Szeredi
2008-05-09 16:40     ` J. Bruce Fields
2008-05-13 21:05       ` Miklos Szeredi
2008-05-13 21:17         ` J. Bruce Fields
2008-05-13 21:21           ` Miklos Szeredi
  -- strict thread matches above, loose matches on Subject: below --
2008-05-15 19:50 [patch 0/9] file locking fixes + fuse nfs export support (v2) Miklos Szeredi
2008-05-15 19:50 ` [patch 9/9] fuse: lockd support Miklos Szeredi

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=20080509124139.816149035@szeredi.hu \
    --to=miklos@szeredi.hu \
    --cc=akpm@linux-foundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).