NFSv4.1: Ensure state manager thread dies on last umount
[firefly-linux-kernel-4.4.55.git] / fs / block_dev.c
index 34e2d2033765ac7ba24e6db65c761f6e39807600..e65efa2f267a89f04cd69262eb0cef53e4646253 100644 (file)
@@ -404,7 +404,7 @@ static loff_t block_llseek(struct file *file, loff_t offset, int origin)
  *     NULL first argument is nfsd_sync_dir() and that's not a directory.
  */
  
-static int block_fsync(struct file *filp, struct dentry *dentry, int datasync)
+int block_fsync(struct file *filp, struct dentry *dentry, int datasync)
 {
        return sync_blockdev(I_BDEV(filp->f_mapping->host));
 }
@@ -423,6 +423,7 @@ static struct inode *bdev_alloc_inode(struct super_block *sb)
                return NULL;
        return &ei->vfs_inode;
 }
+EXPORT_SYMBOL(block_fsync);
 
 static void bdev_destroy_inode(struct inode *inode)
 {
@@ -1174,10 +1175,12 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
        /*
         * hooks: /n/, see "layering violations".
         */
-       ret = devcgroup_inode_permission(bdev->bd_inode, perm);
-       if (ret != 0) {
-               bdput(bdev);
-               return ret;
+       if (!for_part) {
+               ret = devcgroup_inode_permission(bdev->bd_inode, perm);
+               if (ret != 0) {
+                       bdput(bdev);
+                       return ret;
+               }
        }
 
        lock_kernel();