]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/9p/vfs_file.c
Merge branches 'release' and 'stats' into release
[linux-2.6-omap-h63xx.git] / fs / 9p / vfs_file.c
index 2a40c2946d0af718136ed2fe3e6450d148e027d2..a616fff8906d8e803c928981a8cb346f46db7d76 100644 (file)
@@ -105,7 +105,7 @@ static int v9fs_file_lock(struct file *filp, int cmd, struct file_lock *fl)
        P9_DPRINTK(P9_DEBUG_VFS, "filp: %p lock: %p\n", filp, fl);
 
        /* No mandatory locks */
-       if ((inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID)
+       if (__mandatory_lock(inode))
                return -ENOLCK;
 
        if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->fl_type != F_UNLCK) {
@@ -162,15 +162,17 @@ v9fs_file_write(struct file *filp, const char __user * data,
 
        fid = filp->private_data;
        ret = p9_client_uwrite(fid, data, *offset, count);
-       if (ret > 0)
+       if (ret > 0) {
+               invalidate_inode_pages2_range(inode->i_mapping, *offset,
+                                                               *offset+ret);
                *offset += ret;
+       }
 
        if (*offset > inode->i_size) {
                inode->i_size = *offset;
                inode->i_blocks = (inode->i_size + 512 - 1) >> 9;
        }
 
-       invalidate_inode_pages2(inode->i_mapping);
        return ret;
 }
 
@@ -182,7 +184,7 @@ static const struct file_operations v9fs_cached_file_operations = {
        .open = v9fs_file_open,
        .release = v9fs_dir_release,
        .lock = v9fs_file_lock,
-       .mmap = generic_file_mmap,
+       .mmap = generic_file_readonly_mmap,
 };
 
 const struct file_operations v9fs_file_operations = {
@@ -192,5 +194,5 @@ const struct file_operations v9fs_file_operations = {
        .open = v9fs_file_open,
        .release = v9fs_dir_release,
        .lock = v9fs_file_lock,
-       .mmap = generic_file_mmap,
+       .mmap = generic_file_readonly_mmap,
 };