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. Documentation/filesystems/Locking | 2 +- fs/coda/dir.c | 0 fs/nfs/file.c | 2 ++ fs/open.c | 5 +---- 4 files changed, 4 insertions(+), 5 deletions(-) diff -puN fs/coda/dir.c~fops-flush-no-lock_kernel fs/coda/dir.c diff -puN fs/nfs/file.c~fops-flush-no-lock_kernel fs/nfs/file.c --- 25/fs/nfs/file.c~fops-flush-no-lock_kernel 2003-06-28 02:11:36.000000000 -0700 +++ 25-akpm/fs/nfs/file.c 2003-06-28 02:13:35.000000000 -0700 @@ -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); + lock_kernel(); status = nfs_wb_file(inode, file); if (!status) { status = file->f_error; file->f_error = 0; } + unlock_kernel(); return status; } diff -puN fs/open.c~fops-flush-no-lock_kernel fs/open.c --- 25/fs/open.c~fops-flush-no-lock_kernel 2003-06-28 02:11:36.000000000 -0700 +++ 25-akpm/fs/open.c 2003-06-28 02:13:53.000000000 -0700 @@ -952,11 +952,8 @@ int filp_close(struct file *filp, fl_own return 0; } retval = 0; - if (filp->f_op && filp->f_op->flush) { - lock_kernel(); + if (filp->f_op && filp->f_op->flush) retval = filp->f_op->flush(filp); - unlock_kernel(); - } dnotify_flush(filp, id); locks_remove_posix(filp, id); fput(filp); diff -puN Documentation/filesystems/Locking~fops-flush-no-lock_kernel Documentation/filesystems/Locking --- 25/Documentation/filesystems/Locking~fops-flush-no-lock_kernel 2003-06-28 02:13:50.000000000 -0700 +++ 25-akpm/Documentation/filesystems/Locking 2003-06-28 02:13:58.000000000 -0700 @@ -318,7 +318,7 @@ poll: no ioctl: yes (see below) mmap: no open: maybe (see below) -flush: yes +flush: no release: no fsync: yes (see below) fasync: yes (see below) _