From mboxrd@z Thu Jan 1 00:00:00 1970 From: "J. Bruce Fields" Subject: [PATCH 5/6] gfs2: stop giving out non-cluster-coherent leases Date: Fri, 29 Jun 2007 15:21:29 -0400 Message-ID: <11831448903796-git-send-email-bfields@fieldses.org> References: <1183144890244-git-send-email-bfields@fieldses.org> <11831448902131-git-send-email-bfields@fieldses.org> <1183144890833-git-send-email-bfields@fieldses.org> <11831448901518-git-send-email-bfields@fieldses.org> <1183144890363-git-send-email-bfields@fieldses.org> Cc: linux-fsdevel@vger.kernel.org, Marc Eshel , "J. Bruce Fields" , Steven Whitehouse To: Andrew Morton Return-path: Received: from mail.fieldses.org ([66.93.2.214]:59979 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751776AbXF2TVe (ORCPT ); Fri, 29 Jun 2007 15:21:34 -0400 In-Reply-To: <1183144890363-git-send-email-bfields@fieldses.org> Message-Id: <1bdef6b017f0ccb94ed76dbdd2b4cc676e5ef312.1183143820.git.bfields@citi.umich.edu> In-Reply-To: <6e0beaf3e950494a6903571f0b5c9b61fc7bf650.1183143819.git.bfields@citi.umich.edu> References: <6e0beaf3e950494a6903571f0b5c9b61fc7bf650.1183143819.git.bfields@citi.umich.edu> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org From: Marc Eshel Since gfs2 can't prevent conflicting opens or leases on other nodes, we probably shouldn't allow it to give out leases at all. Put the newly defined lease operation into use in gfs2 by turning off lease, unless we're using the "nolock' locking module (in which case all locking is local anyway). Signed-off-by: Marc Eshel Signed-off-by: J. Bruce Fields Cc: Steven Whitehouse --- fs/gfs2/ops_file.c | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-) diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c index 064df88..e34d9bd 100644 --- a/fs/gfs2/ops_file.c +++ b/fs/gfs2/ops_file.c @@ -489,6 +489,31 @@ static int gfs2_fsync(struct file *file, struct dentry *dentry, int datasync) } /** + * gfs2_setlease - acquire/release a file lease + * @file: the file pointer + * @arg: lease type + * @fl: file lock + * + * Returns: errno + */ + +static int gfs2_setlease(struct file *file, long arg, struct file_lock **fl) +{ + struct gfs2_sbd *sdp = GFS2_SB(file->f_mapping->host); + int ret = -EOPNOTSUPP; + + if (sdp->sd_args.ar_localflocks) { + return setlease(file, arg, fl); + } + + /* For now fail the delegation request. Cluster file system can not + allow any node in the cluster to get a local lease until it can + be managed centrally by the cluster file system. + */ + return ret; +} + +/** * gfs2_lock - acquire/release a posix lock on a file * @file: the file pointer * @cmd: either modify or retrieve lock state, possibly wait @@ -639,6 +664,7 @@ const struct file_operations gfs2_file_fops = { .flock = gfs2_flock, .splice_read = generic_file_splice_read, .splice_write = generic_file_splice_write, + .setlease = gfs2_setlease, }; const struct file_operations gfs2_dir_fops = { -- 1.5.2.58.g98ee