From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
To: Oren Laadan <orenl@cs.columbia.edu>
Cc: Containers <containers@lists.linux-foundation.org>,
linux-fsdevel@vger.kernel.org, serue@us.ibm.com,
matthltc@us.ibm.com, sukadev@us.ibm.com
Subject: [RFC][cr][PATCH 5/6] Define do_setlease()
Date: Tue, 4 May 2010 22:32:05 -0700 [thread overview]
Message-ID: <20100505053205.GE20993@us.ibm.com> (raw)
In-Reply-To: <20100505053016.GA20483@us.ibm.com>
>From 3ee14213853e8d72fb8b9791bc1441533952347e Mon Sep 17 00:00:00 2001
From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Date: Tue, 4 May 2010 10:59:09 -0700
Subject: [RFC][cr][PATCH 5/6] Define do_setlease()
Move the core functionality of fcntl_setlease() into a new function,
do_setlease(). do_setlease() is same as fcntl_setlease() except that
it takes an extra 'rem_lease' parameter. do_setlease() will be used
in a follow-on patch to checkpoint/restart file-leases.
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
---
fs/locks.c | 28 +++++++++++++++++-----------
include/linux/fs.h | 1 +
2 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/fs/locks.c b/fs/locks.c
index 6c6ced4..053ac5f 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1471,17 +1471,7 @@ int vfs_setlease(struct file *filp, long arg, struct file_lock **lease)
}
EXPORT_SYMBOL_GPL(vfs_setlease);
-/**
- * fcntl_setlease - sets a lease on an open file
- * @fd: open file descriptor
- * @filp: file pointer
- * @arg: type of lease to obtain
- *
- * Call this fcntl to establish a lease on the file.
- * Note that you also need to call %F_SETSIG to
- * receive a signal when the lease is broken.
- */
-int fcntl_setlease(unsigned int fd, struct file *filp, long arg)
+int do_setlease(unsigned int fd, struct file *filp, long arg, int rem_lease)
{
struct file_lock fl, *flp = &fl;
struct inode *inode = filp->f_path.dentry->d_inode;
@@ -1508,12 +1498,28 @@ int fcntl_setlease(unsigned int fd, struct file *filp, long arg)
}
error = __f_setown(filp, task_pid(current), PIDTYPE_PID, 0);
+
out_unlock:
unlock_kernel();
return error;
}
/**
+ * fcntl_setlease - sets a lease on an open file
+ * @fd: open file descriptor
+ * @filp: file pointer
+ * @arg: type of lease to obtain
+ *
+ * Call this fcntl to establish a lease on the file.
+ * Note that you also need to call %F_SETSIG to
+ * receive a signal when the lease is broken.
+ */
+int fcntl_setlease(unsigned int fd, struct file *filp, long arg)
+{
+ return do_setlease(fd, filp, arg, 0);
+}
+
+/**
* flock_lock_file_wait - Apply a FLOCK-style lock to a file
* @filp: The file to apply the lock to
* @fl: The lock to be applied
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 5e9ea17..137f244 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1120,6 +1120,7 @@ extern int fcntl_setlk64(unsigned int, struct file *, unsigned int,
struct flock64 __user *);
#endif
+extern int do_setlease(unsigned int fd, struct file *filp, long arg, int rem_lease);
extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg);
extern int fcntl_getlease(struct file *filp);
--
1.6.0.4
next prev parent reply other threads:[~2010-05-05 5:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-05 5:30 [RFC][PATCH 0/6][cr]: Checkpoint/restart file locks and leases Sukadev Bhattiprolu
2010-05-05 5:30 ` [RFC][cr][PATCH 1/6] Move file_lock macros into linux/fs.h Sukadev Bhattiprolu
2010-05-05 5:31 ` [RFC][cr][PATCH 2/6] Checkpoint file-locks Sukadev Bhattiprolu
2010-05-05 5:31 ` [RFC][cr][PATCH 3/6] Define flock_set() Sukadev Bhattiprolu
2010-05-05 5:31 ` [RFC][cr][PATCH 4/6] Restore file-locks Sukadev Bhattiprolu
2010-05-05 5:32 ` Sukadev Bhattiprolu [this message]
2010-05-05 5:32 ` [RFC][cr][PATCH 6/6] Checkpoint/restart file leases Sukadev Bhattiprolu
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=20100505053205.GE20993@us.ibm.com \
--to=sukadev@linux.vnet.ibm.com \
--cc=containers@lists.linux-foundation.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=matthltc@us.ibm.com \
--cc=orenl@cs.columbia.edu \
--cc=serue@us.ibm.com \
--cc=sukadev@us.ibm.com \
/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).