summaryrefslogtreecommitdiffstats
path: root/module/spl
diff options
context:
space:
mode:
authorRichard Yao <[email protected]>2015-02-17 10:12:56 -0500
committerBrian Behlendorf <[email protected]>2015-04-24 13:02:37 -0700
commitd3c677bcd330423c72cd4d4100727e5c1e8c1f38 (patch)
tree5c4652b9e6c2ca91c92640361d3867bb5b0d74ba /module/spl
parent313b1ea622275e24c3046c3b04a98a933b18f8de (diff)
Implement areleasef()
Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #449
Diffstat (limited to 'module/spl')
-rw-r--r--module/spl/spl-vnode.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/module/spl/spl-vnode.c b/module/spl/spl-vnode.c
index 4c62097dc..ab9830d18 100644
--- a/module/spl/spl-vnode.c
+++ b/module/spl/spl-vnode.c
@@ -623,14 +623,14 @@ EXPORT_SYMBOL(vn_space);
/* Function must be called while holding the vn_file_lock */
static file_t *
-file_find(int fd)
+file_find(int fd, struct task_struct *task)
{
file_t *fp;
ASSERT(spin_is_locked(&vn_file_lock));
list_for_each_entry(fp, &vn_file_list, f_list) {
- if (fd == fp->f_fd && fp->f_task == current) {
+ if (fd == fp->f_fd && fp->f_task == task) {
ASSERT(atomic_read(&fp->f_ref) != 0);
return fp;
}
@@ -654,7 +654,7 @@ vn_getf(int fd)
/* Already open just take an extra reference */
spin_lock(&vn_file_lock);
- fp = file_find(fd);
+ fp = file_find(fd, current);
if (fp) {
atomic_inc(&fp->f_ref);
spin_unlock(&vn_file_lock);
@@ -734,13 +734,21 @@ static void releasef_locked(file_t *fp)
void
vn_releasef(int fd)
{
+ areleasef(fd, P_FINFO(current));
+}
+EXPORT_SYMBOL(releasef);
+
+void
+vn_areleasef(int fd, uf_info_t *fip)
+{
file_t *fp;
+ struct task_struct *task = (struct task_struct *)fip;
if (fd < 0)
return;
spin_lock(&vn_file_lock);
- fp = file_find(fd);
+ fp = file_find(fd, task);
if (fp) {
atomic_dec(&fp->f_ref);
if (atomic_read(&fp->f_ref) > 0) {
@@ -755,7 +763,8 @@ vn_releasef(int fd)
return;
} /* releasef() */
-EXPORT_SYMBOL(releasef);
+EXPORT_SYMBOL(areleasef);
+
static void
#ifdef HAVE_SET_FS_PWD_WITH_CONST