diff options
Diffstat (limited to 'fs/btrfs/file.c')
-rw-r--r-- | fs/btrfs/file.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 3e8023efaff7..872f104576e5 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -1222,7 +1222,7 @@ int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync) | |||
1222 | /* | 1222 | /* |
1223 | * ok we haven't committed the transaction yet, lets do a commit | 1223 | * ok we haven't committed the transaction yet, lets do a commit |
1224 | */ | 1224 | */ |
1225 | if (file->private_data) | 1225 | if (file && file->private_data) |
1226 | btrfs_ioctl_trans_end(file); | 1226 | btrfs_ioctl_trans_end(file); |
1227 | 1227 | ||
1228 | trans = btrfs_start_transaction(root, 1); | 1228 | trans = btrfs_start_transaction(root, 1); |
@@ -1231,7 +1231,7 @@ int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync) | |||
1231 | goto out; | 1231 | goto out; |
1232 | } | 1232 | } |
1233 | 1233 | ||
1234 | ret = btrfs_log_dentry_safe(trans, root, file->f_dentry); | 1234 | ret = btrfs_log_dentry_safe(trans, root, dentry); |
1235 | if (ret < 0) | 1235 | if (ret < 0) |
1236 | goto out; | 1236 | goto out; |
1237 | 1237 | ||
@@ -1245,7 +1245,7 @@ int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync) | |||
1245 | * file again, but that will end up using the synchronization | 1245 | * file again, but that will end up using the synchronization |
1246 | * inside btrfs_sync_log to keep things safe. | 1246 | * inside btrfs_sync_log to keep things safe. |
1247 | */ | 1247 | */ |
1248 | mutex_unlock(&file->f_dentry->d_inode->i_mutex); | 1248 | mutex_unlock(&dentry->d_inode->i_mutex); |
1249 | 1249 | ||
1250 | if (ret > 0) { | 1250 | if (ret > 0) { |
1251 | ret = btrfs_commit_transaction(trans, root); | 1251 | ret = btrfs_commit_transaction(trans, root); |
@@ -1253,7 +1253,7 @@ int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync) | |||
1253 | btrfs_sync_log(trans, root); | 1253 | btrfs_sync_log(trans, root); |
1254 | ret = btrfs_end_transaction(trans, root); | 1254 | ret = btrfs_end_transaction(trans, root); |
1255 | } | 1255 | } |
1256 | mutex_lock(&file->f_dentry->d_inode->i_mutex); | 1256 | mutex_lock(&dentry->d_inode->i_mutex); |
1257 | out: | 1257 | out: |
1258 | return ret > 0 ? EIO : ret; | 1258 | return ret > 0 ? EIO : ret; |
1259 | } | 1259 | } |