From b6a91d6443d2bd427069ef81332d10252a4c5bf8 Mon Sep 17 00:00:00 2001 From: Marc Eshel Date: Mon, 15 Jan 2007 18:33:36 -0500 Subject: [PATCH] --- yaml --- r: 61450 b: refs/heads/master c: 60446067ba7a8e890a91db3b4a7436fe0ebd2dee h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/gfs2/ops_file.c | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 0101d3706617..752c2cbc10bc 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 4698afe8e3a725576366f86560a8a8242b21b9f7 +refs/heads/master: 60446067ba7a8e890a91db3b4a7436fe0ebd2dee diff --git a/trunk/fs/gfs2/ops_file.c b/trunk/fs/gfs2/ops_file.c index 196d83266e34..1a5e8e893d75 100644 --- a/trunk/fs/gfs2/ops_file.c +++ b/trunk/fs/gfs2/ops_file.c @@ -488,6 +488,29 @@ static int gfs2_fsync(struct file *file, struct dentry *dentry, int datasync) return ret; } +/** + * 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); + + /* + * We don't currently have a way to enforce a lease across the whole + * cluster; until we do, disable leases (by just returning -EINVAL), + * unless the administrator has requested purely local locking. + */ + if (!sdp->sd_args.ar_localflocks) + return -EINVAL; + return setlease(file, arg, fl); +} + /** * gfs2_lock - acquire/release a posix lock on a file * @file: the file pointer @@ -638,6 +661,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 = {