diff options
author | Marc Eshel <eshel@almaden.ibm.com> | 2007-01-15 18:33:36 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2007-07-18 19:17:19 -0400 |
commit | 60446067ba7a8e890a91db3b4a7436fe0ebd2dee (patch) | |
tree | 17ce000f5f70ef7f53a94ce594d15f10fa964cd0 /fs/gfs2/ops_file.c | |
parent | 4698afe8e3a725576366f86560a8a8242b21b9f7 (diff) |
gfs2: stop giving out non-cluster-coherent leases
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 <eshel@almaden.ibm.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Cc: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/ops_file.c')
-rw-r--r-- | fs/gfs2/ops_file.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c index 196d83266e34..1a5e8e893d75 100644 --- a/fs/gfs2/ops_file.c +++ b/fs/gfs2/ops_file.c | |||
@@ -489,6 +489,29 @@ static int gfs2_fsync(struct file *file, struct dentry *dentry, int datasync) | |||
489 | } | 489 | } |
490 | 490 | ||
491 | /** | 491 | /** |
492 | * gfs2_setlease - acquire/release a file lease | ||
493 | * @file: the file pointer | ||
494 | * @arg: lease type | ||
495 | * @fl: file lock | ||
496 | * | ||
497 | * Returns: errno | ||
498 | */ | ||
499 | |||
500 | static int gfs2_setlease(struct file *file, long arg, struct file_lock **fl) | ||
501 | { | ||
502 | struct gfs2_sbd *sdp = GFS2_SB(file->f_mapping->host); | ||
503 | |||
504 | /* | ||
505 | * We don't currently have a way to enforce a lease across the whole | ||
506 | * cluster; until we do, disable leases (by just returning -EINVAL), | ||
507 | * unless the administrator has requested purely local locking. | ||
508 | */ | ||
509 | if (!sdp->sd_args.ar_localflocks) | ||
510 | return -EINVAL; | ||
511 | return setlease(file, arg, fl); | ||
512 | } | ||
513 | |||
514 | /** | ||
492 | * gfs2_lock - acquire/release a posix lock on a file | 515 | * gfs2_lock - acquire/release a posix lock on a file |
493 | * @file: the file pointer | 516 | * @file: the file pointer |
494 | * @cmd: either modify or retrieve lock state, possibly wait | 517 | * @cmd: either modify or retrieve lock state, possibly wait |
@@ -638,6 +661,7 @@ const struct file_operations gfs2_file_fops = { | |||
638 | .flock = gfs2_flock, | 661 | .flock = gfs2_flock, |
639 | .splice_read = generic_file_splice_read, | 662 | .splice_read = generic_file_splice_read, |
640 | .splice_write = generic_file_splice_write, | 663 | .splice_write = generic_file_splice_write, |
664 | .setlease = gfs2_setlease, | ||
641 | }; | 665 | }; |
642 | 666 | ||
643 | const struct file_operations gfs2_dir_fops = { | 667 | const struct file_operations gfs2_dir_fops = { |