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.
ioctl: yes (see below)
mmap: no
open: maybe (see below)
-flush: yes
+flush: no
release: no
fsync: yes (see below)
fasync: yes (see below)
struct inode *coda_inode;
int err = 0, fcnt;
+ lock_kernel();
+
coda_vfs_stat.flush++;
/* last close semantics */
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
* to the file */
if ((coda_file->f_flags & O_ACCMODE) == O_RDONLY)
- return 0;
+ goto out;
if (use_coda_close)
- return 0;
+ goto out;
cfi = CODA_FTOC(coda_file);
BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
err = 0;
}
+out:
+ unlock_kernel();
return err;
}
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;
}
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);