]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] remove lock_kernel() from file_ops.flush()
authorAndrew Morton <akpm@osdl.org>
Wed, 2 Jul 2003 15:48:26 +0000 (08:48 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Wed, 2 Jul 2003 15:48:26 +0000 (08:48 -0700)
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
fs/coda/file.c
fs/nfs/file.c
fs/open.c

index 03f43b68e801492fbc0638c10504c7a9b521e378..56d482903188ba6556ae648c614862fe403f5a21 100644 (file)
@@ -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)
index 486ca3af939cfe51d3303a63d7847cd0ae36ba06..8d4865cbc91aa6ac98dd4892bf856ddcc15ee289 100644 (file)
@@ -153,19 +153,22 @@ int coda_flush(struct file *coda_file)
        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);
@@ -180,6 +183,8 @@ int coda_flush(struct file *coda_file)
                err = 0;
        }
 
+out:
+       unlock_kernel();
        return err;
 }
 
index 26956c7de1d818d6ef38440c7f532744e0e97666..c440dc858825dcc2f172501c9621c1e17d9ef8f8 100644 (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);
 
+       lock_kernel();
        status = nfs_wb_file(inode, file);
        if (!status) {
                status = file->f_error;
                file->f_error = 0;
        }
+       unlock_kernel();
        return status;
 }
 
index 2e2e4e4dae976bfa98bbc027b745199427bafcf5..98ce4f7374ef081f2d7d47e07607ded99e11f654 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -952,11 +952,8 @@ int filp_close(struct file *filp, fl_owner_t id)
                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);