diff options
-rw-r--r-- | fs/ecryptfs/read_write.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/fs/ecryptfs/read_write.c b/fs/ecryptfs/read_write.c index ec3d9368dc5b..608c1c3fde1b 100644 --- a/fs/ecryptfs/read_write.c +++ b/fs/ecryptfs/read_write.c | |||
@@ -132,6 +132,11 @@ int ecryptfs_write(struct inode *ecryptfs_inode, char *data, loff_t offset, | |||
132 | size_t num_bytes = (PAGE_CACHE_SIZE - start_offset_in_page); | 132 | size_t num_bytes = (PAGE_CACHE_SIZE - start_offset_in_page); |
133 | loff_t total_remaining_bytes = ((offset + size) - pos); | 133 | loff_t total_remaining_bytes = ((offset + size) - pos); |
134 | 134 | ||
135 | if (fatal_signal_pending(current)) { | ||
136 | rc = -EINTR; | ||
137 | break; | ||
138 | } | ||
139 | |||
135 | if (num_bytes > total_remaining_bytes) | 140 | if (num_bytes > total_remaining_bytes) |
136 | num_bytes = total_remaining_bytes; | 141 | num_bytes = total_remaining_bytes; |
137 | if (pos < offset) { | 142 | if (pos < offset) { |
@@ -193,15 +198,19 @@ int ecryptfs_write(struct inode *ecryptfs_inode, char *data, loff_t offset, | |||
193 | } | 198 | } |
194 | pos += num_bytes; | 199 | pos += num_bytes; |
195 | } | 200 | } |
196 | if ((offset + size) > ecryptfs_file_size) { | 201 | if (pos > ecryptfs_file_size) { |
197 | i_size_write(ecryptfs_inode, (offset + size)); | 202 | i_size_write(ecryptfs_inode, pos); |
198 | if (crypt_stat->flags & ECRYPTFS_ENCRYPTED) { | 203 | if (crypt_stat->flags & ECRYPTFS_ENCRYPTED) { |
199 | rc = ecryptfs_write_inode_size_to_metadata( | 204 | int rc2; |
205 | |||
206 | rc2 = ecryptfs_write_inode_size_to_metadata( | ||
200 | ecryptfs_inode); | 207 | ecryptfs_inode); |
201 | if (rc) { | 208 | if (rc2) { |
202 | printk(KERN_ERR "Problem with " | 209 | printk(KERN_ERR "Problem with " |
203 | "ecryptfs_write_inode_size_to_metadata; " | 210 | "ecryptfs_write_inode_size_to_metadata; " |
204 | "rc = [%d]\n", rc); | 211 | "rc = [%d]\n", rc2); |
212 | if (!rc) | ||
213 | rc = rc2; | ||
205 | goto out; | 214 | goto out; |
206 | } | 215 | } |
207 | } | 216 | } |