Commit e90f7e03 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] remove lock_kernel() from file_ops.flush()

Rework the file_ops.flush() API sothat it is no longer called under
lock_kernel().  Push lock_kernel() down to all impementations except CIFS,
which doesn't want it.
parent 10be509c
...@@ -318,7 +318,7 @@ poll: no ...@@ -318,7 +318,7 @@ poll: no
ioctl: yes (see below) ioctl: yes (see below)
mmap: no mmap: no
open: maybe (see below) open: maybe (see below)
flush: yes flush: no
release: no release: no
fsync: yes (see below) fsync: yes (see below)
fasync: yes (see below) fasync: yes (see below)
......
...@@ -153,19 +153,22 @@ int coda_flush(struct file *coda_file) ...@@ -153,19 +153,22 @@ int coda_flush(struct file *coda_file)
struct inode *coda_inode; struct inode *coda_inode;
int err = 0, fcnt; int err = 0, fcnt;
lock_kernel();
coda_vfs_stat.flush++; coda_vfs_stat.flush++;
/* last close semantics */ /* last close semantics */
fcnt = file_count(coda_file); fcnt = file_count(coda_file);
if (fcnt > 1) return 0; if (fcnt > 1)
goto out;
/* No need to make an upcall when we have not made any modifications /* No need to make an upcall when we have not made any modifications
* to the file */ * to the file */
if ((coda_file->f_flags & O_ACCMODE) == O_RDONLY) if ((coda_file->f_flags & O_ACCMODE) == O_RDONLY)
return 0; goto out;
if (use_coda_close) if (use_coda_close)
return 0; goto out;
cfi = CODA_FTOC(coda_file); cfi = CODA_FTOC(coda_file);
BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC); BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
...@@ -180,6 +183,8 @@ int coda_flush(struct file *coda_file) ...@@ -180,6 +183,8 @@ int coda_flush(struct file *coda_file)
err = 0; err = 0;
} }
out:
unlock_kernel();
return err; return err;
} }
......
...@@ -104,11 +104,13 @@ nfs_file_flush(struct file *file) ...@@ -104,11 +104,13 @@ nfs_file_flush(struct file *file)
dfprintk(VFS, "nfs: flush(%s/%ld)\n", inode->i_sb->s_id, inode->i_ino); dfprintk(VFS, "nfs: flush(%s/%ld)\n", inode->i_sb->s_id, inode->i_ino);
lock_kernel();
status = nfs_wb_file(inode, file); status = nfs_wb_file(inode, file);
if (!status) { if (!status) {
status = file->f_error; status = file->f_error;
file->f_error = 0; file->f_error = 0;
} }
unlock_kernel();
return status; return status;
} }
......
...@@ -952,11 +952,8 @@ int filp_close(struct file *filp, fl_owner_t id) ...@@ -952,11 +952,8 @@ int filp_close(struct file *filp, fl_owner_t id)
return 0; return 0;
} }
retval = 0; retval = 0;
if (filp->f_op && filp->f_op->flush) { if (filp->f_op && filp->f_op->flush)
lock_kernel();
retval = filp->f_op->flush(filp); retval = filp->f_op->flush(filp);
unlock_kernel();
}
dnotify_flush(filp, id); dnotify_flush(filp, id);
locks_remove_posix(filp, id); locks_remove_posix(filp, id);
fput(filp); fput(filp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment