From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1763372AbYEIMnT (ORCPT ); Fri, 9 May 2008 08:43:19 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1760936AbYEIMli (ORCPT ); Fri, 9 May 2008 08:41:38 -0400 Received: from fxip-0047f.externet.hu ([88.209.222.127]:59646 "EHLO pomaz-ex.szeredi.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759010AbYEIMle (ORCPT ); Fri, 9 May 2008 08:41:34 -0400 Message-Id: <20080509124130.847057904@szeredi.hu> References: <20080509124107.645600519@szeredi.hu> User-Agent: quilt/0.45-1 Date: Fri, 09 May 2008 14:41:11 +0200 From: Miklos Szeredi To: akpm@linux-foundation.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, "J. Bruce Fields" , Matthew Wilcox Subject: [patch 4/9] locks: allow ->lock() to return FILE_LOCK_DEFERRED Content-Disposition: inline; filename=locks_allow_async_lock_method.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Miklos Szeredi Allow filesystem's ->lock() method to call posix_lock_file() instead of posix_lock_file_wait(), and return FILE_LOCK_DEFERRED. This makes it possible to implement a such a ->lock() function, that works with the lock manager, which needs the call to be asynchronous. Now the vfs_lock_file() helper can be used, so this is a cleanup as well. Signed-off-by: Miklos Szeredi CC: "J. Bruce Fields" CC: Matthew Wilcox --- fs/locks.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) Index: linux-2.6/fs/locks.c =================================================================== --- linux-2.6.orig/fs/locks.c 2008-05-09 14:04:47.000000000 +0200 +++ linux-2.6/fs/locks.c 2008-05-09 14:04:48.000000000 +0200 @@ -1753,21 +1753,16 @@ static int do_lock_file_wait(struct file if (error) return error; - if (filp->f_op && filp->f_op->lock != NULL) - error = filp->f_op->lock(filp, cmd, fl); - else { - for (;;) { - error = posix_lock_file(filp, fl, NULL); - if (error != FILE_LOCK_DEFERRED) - break; - error = wait_event_interruptible(fl->fl_wait, - !fl->fl_next); - if (!error) - continue; - - locks_delete_block(fl); + for (;;) { + error = vfs_lock_file(filp, cmd, fl, NULL); + if (error != FILE_LOCK_DEFERRED) break; - } + error = wait_event_interruptible(fl->fl_wait, !fl->fl_next); + if (!error) + continue; + + locks_delete_block(fl); + break; } return error; --