diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cifs/inode.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 24df13a256e5..03ade0f972b4 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -1139,15 +1139,17 @@ int cifs_vmtruncate(struct inode * inode, loff_t offset) | |||
1139 | struct address_space *mapping = inode->i_mapping; | 1139 | struct address_space *mapping = inode->i_mapping; |
1140 | unsigned long limit; | 1140 | unsigned long limit; |
1141 | 1141 | ||
1142 | spin_lock(&inode->i_lock); | ||
1142 | if (inode->i_size < offset) | 1143 | if (inode->i_size < offset) |
1143 | goto do_expand; | 1144 | goto do_expand; |
1144 | /* | 1145 | /* |
1145 | * truncation of in-use swapfiles is disallowed - it would cause | 1146 | * truncation of in-use swapfiles is disallowed - it would cause |
1146 | * subsequent swapout to scribble on the now-freed blocks. | 1147 | * subsequent swapout to scribble on the now-freed blocks. |
1147 | */ | 1148 | */ |
1148 | if (IS_SWAPFILE(inode)) | 1149 | if (IS_SWAPFILE(inode)) { |
1150 | spin_unlock(&inode->i_lock); | ||
1149 | goto out_busy; | 1151 | goto out_busy; |
1150 | spin_lock(&inode->i_lock); | 1152 | } |
1151 | i_size_write(inode, offset); | 1153 | i_size_write(inode, offset); |
1152 | spin_unlock(&inode->i_lock); | 1154 | spin_unlock(&inode->i_lock); |
1153 | unmap_mapping_range(mapping, offset + PAGE_SIZE - 1, 0, 1); | 1155 | unmap_mapping_range(mapping, offset + PAGE_SIZE - 1, 0, 1); |
@@ -1156,12 +1158,16 @@ int cifs_vmtruncate(struct inode * inode, loff_t offset) | |||
1156 | 1158 | ||
1157 | do_expand: | 1159 | do_expand: |
1158 | limit = current->signal->rlim[RLIMIT_FSIZE].rlim_cur; | 1160 | limit = current->signal->rlim[RLIMIT_FSIZE].rlim_cur; |
1159 | if (limit != RLIM_INFINITY && offset > limit) | 1161 | if (limit != RLIM_INFINITY && offset > limit) { |
1162 | spin_unlock(&inode->i_lock); | ||
1160 | goto out_sig; | 1163 | goto out_sig; |
1161 | if (offset > inode->i_sb->s_maxbytes) | 1164 | } |
1165 | if (offset > inode->i_sb->s_maxbytes) { | ||
1166 | spin_unlock(&inode->i_lock); | ||
1162 | goto out_big; | 1167 | goto out_big; |
1168 | } | ||
1163 | i_size_write(inode, offset); | 1169 | i_size_write(inode, offset); |
1164 | 1170 | spin_unlock(&inode->i_lock); | |
1165 | out_truncate: | 1171 | out_truncate: |
1166 | if (inode->i_op && inode->i_op->truncate) | 1172 | if (inode->i_op && inode->i_op->truncate) |
1167 | inode->i_op->truncate(inode); | 1173 | inode->i_op->truncate(inode); |