diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/binfmt_elf.c | 15 | ||||
-rw-r--r-- | fs/buffer.c | 2 | ||||
-rw-r--r-- | fs/ecryptfs/mmap.c | 102 | ||||
-rw-r--r-- | fs/ext3/super.c | 2 | ||||
-rw-r--r-- | fs/reiserfs/super.c | 2 |
5 files changed, 94 insertions, 29 deletions
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 41a958a7585e..5e1a4fb5cacb 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -1424,6 +1424,18 @@ struct elf_note_info { | |||
1424 | int thread_notes; | 1424 | int thread_notes; |
1425 | }; | 1425 | }; |
1426 | 1426 | ||
1427 | /* | ||
1428 | * When a regset has a writeback hook, we call it on each thread before | ||
1429 | * dumping user memory. On register window machines, this makes sure the | ||
1430 | * user memory backing the register data is up to date before we read it. | ||
1431 | */ | ||
1432 | static void do_thread_regset_writeback(struct task_struct *task, | ||
1433 | const struct user_regset *regset) | ||
1434 | { | ||
1435 | if (regset->writeback) | ||
1436 | regset->writeback(task, regset, 1); | ||
1437 | } | ||
1438 | |||
1427 | static int fill_thread_core_info(struct elf_thread_core_info *t, | 1439 | static int fill_thread_core_info(struct elf_thread_core_info *t, |
1428 | const struct user_regset_view *view, | 1440 | const struct user_regset_view *view, |
1429 | long signr, size_t *total) | 1441 | long signr, size_t *total) |
@@ -1445,6 +1457,8 @@ static int fill_thread_core_info(struct elf_thread_core_info *t, | |||
1445 | sizeof(t->prstatus), &t->prstatus); | 1457 | sizeof(t->prstatus), &t->prstatus); |
1446 | *total += notesize(&t->notes[0]); | 1458 | *total += notesize(&t->notes[0]); |
1447 | 1459 | ||
1460 | do_thread_regset_writeback(t->task, &view->regsets[0]); | ||
1461 | |||
1448 | /* | 1462 | /* |
1449 | * Each other regset might generate a note too. For each regset | 1463 | * Each other regset might generate a note too. For each regset |
1450 | * that has no core_note_type or is inactive, we leave t->notes[i] | 1464 | * that has no core_note_type or is inactive, we leave t->notes[i] |
@@ -1452,6 +1466,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t, | |||
1452 | */ | 1466 | */ |
1453 | for (i = 1; i < view->n; ++i) { | 1467 | for (i = 1; i < view->n; ++i) { |
1454 | const struct user_regset *regset = &view->regsets[i]; | 1468 | const struct user_regset *regset = &view->regsets[i]; |
1469 | do_thread_regset_writeback(t->task, regset); | ||
1455 | if (regset->core_note_type && | 1470 | if (regset->core_note_type && |
1456 | (!regset->active || regset->active(t->task, regset))) { | 1471 | (!regset->active || regset->active(t->task, regset))) { |
1457 | int ret; | 1472 | int ret; |
diff --git a/fs/buffer.c b/fs/buffer.c index 897cd7477b34..ddfdd2c80bf9 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -835,7 +835,7 @@ static int fsync_buffers_list(spinlock_t *lock, struct list_head *list) | |||
835 | smp_mb(); | 835 | smp_mb(); |
836 | if (buffer_dirty(bh)) { | 836 | if (buffer_dirty(bh)) { |
837 | list_add(&bh->b_assoc_buffers, | 837 | list_add(&bh->b_assoc_buffers, |
838 | &bh->b_assoc_map->private_list); | 838 | &mapping->private_list); |
839 | bh->b_assoc_map = mapping; | 839 | bh->b_assoc_map = mapping; |
840 | } | 840 | } |
841 | spin_unlock(lock); | 841 | spin_unlock(lock); |
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c index dc74b186145d..6df1debdccce 100644 --- a/fs/ecryptfs/mmap.c +++ b/fs/ecryptfs/mmap.c | |||
@@ -263,52 +263,102 @@ out: | |||
263 | return 0; | 263 | return 0; |
264 | } | 264 | } |
265 | 265 | ||
266 | /* This function must zero any hole we create */ | 266 | /** |
267 | * ecryptfs_prepare_write | ||
268 | * @file: The eCryptfs file | ||
269 | * @page: The eCryptfs page | ||
270 | * @from: The start byte from which we will write | ||
271 | * @to: The end byte to which we will write | ||
272 | * | ||
273 | * This function must zero any hole we create | ||
274 | * | ||
275 | * Returns zero on success; non-zero otherwise | ||
276 | */ | ||
267 | static int ecryptfs_prepare_write(struct file *file, struct page *page, | 277 | static int ecryptfs_prepare_write(struct file *file, struct page *page, |
268 | unsigned from, unsigned to) | 278 | unsigned from, unsigned to) |
269 | { | 279 | { |
270 | int rc = 0; | ||
271 | loff_t prev_page_end_size; | 280 | loff_t prev_page_end_size; |
281 | int rc = 0; | ||
272 | 282 | ||
273 | if (!PageUptodate(page)) { | 283 | if (!PageUptodate(page)) { |
274 | rc = ecryptfs_read_lower_page_segment(page, page->index, 0, | 284 | struct ecryptfs_crypt_stat *crypt_stat = |
275 | PAGE_CACHE_SIZE, | 285 | &ecryptfs_inode_to_private( |
276 | page->mapping->host); | 286 | file->f_path.dentry->d_inode)->crypt_stat; |
277 | if (rc) { | 287 | |
278 | printk(KERN_ERR "%s: Error attemping to read lower " | 288 | if (!(crypt_stat->flags & ECRYPTFS_ENCRYPTED) |
279 | "page segment; rc = [%d]\n", __FUNCTION__, rc); | 289 | || (crypt_stat->flags & ECRYPTFS_NEW_FILE)) { |
280 | ClearPageUptodate(page); | 290 | rc = ecryptfs_read_lower_page_segment( |
281 | goto out; | 291 | page, page->index, 0, PAGE_CACHE_SIZE, |
282 | } else | 292 | page->mapping->host); |
293 | if (rc) { | ||
294 | printk(KERN_ERR "%s: Error attemping to read " | ||
295 | "lower page segment; rc = [%d]\n", | ||
296 | __FUNCTION__, rc); | ||
297 | ClearPageUptodate(page); | ||
298 | goto out; | ||
299 | } else | ||
300 | SetPageUptodate(page); | ||
301 | } else if (crypt_stat->flags & ECRYPTFS_VIEW_AS_ENCRYPTED) { | ||
302 | if (crypt_stat->flags & ECRYPTFS_METADATA_IN_XATTR) { | ||
303 | rc = ecryptfs_copy_up_encrypted_with_header( | ||
304 | page, crypt_stat); | ||
305 | if (rc) { | ||
306 | printk(KERN_ERR "%s: Error attempting " | ||
307 | "to copy the encrypted content " | ||
308 | "from the lower file whilst " | ||
309 | "inserting the metadata from " | ||
310 | "the xattr into the header; rc " | ||
311 | "= [%d]\n", __FUNCTION__, rc); | ||
312 | ClearPageUptodate(page); | ||
313 | goto out; | ||
314 | } | ||
315 | SetPageUptodate(page); | ||
316 | } else { | ||
317 | rc = ecryptfs_read_lower_page_segment( | ||
318 | page, page->index, 0, PAGE_CACHE_SIZE, | ||
319 | page->mapping->host); | ||
320 | if (rc) { | ||
321 | printk(KERN_ERR "%s: Error reading " | ||
322 | "page; rc = [%d]\n", | ||
323 | __FUNCTION__, rc); | ||
324 | ClearPageUptodate(page); | ||
325 | goto out; | ||
326 | } | ||
327 | SetPageUptodate(page); | ||
328 | } | ||
329 | } else { | ||
330 | rc = ecryptfs_decrypt_page(page); | ||
331 | if (rc) { | ||
332 | printk(KERN_ERR "%s: Error decrypting page " | ||
333 | "at index [%ld]; rc = [%d]\n", | ||
334 | __FUNCTION__, page->index, rc); | ||
335 | ClearPageUptodate(page); | ||
336 | goto out; | ||
337 | } | ||
283 | SetPageUptodate(page); | 338 | SetPageUptodate(page); |
339 | } | ||
284 | } | 340 | } |
285 | |||
286 | prev_page_end_size = ((loff_t)page->index << PAGE_CACHE_SHIFT); | 341 | prev_page_end_size = ((loff_t)page->index << PAGE_CACHE_SHIFT); |
287 | 342 | /* If creating a page or more of holes, zero them out via truncate. | |
288 | /* | 343 | * Note, this will increase i_size. */ |
289 | * If creating a page or more of holes, zero them out via truncate. | ||
290 | * Note, this will increase i_size. | ||
291 | */ | ||
292 | if (page->index != 0) { | 344 | if (page->index != 0) { |
293 | if (prev_page_end_size > i_size_read(page->mapping->host)) { | 345 | if (prev_page_end_size > i_size_read(page->mapping->host)) { |
294 | rc = ecryptfs_truncate(file->f_path.dentry, | 346 | rc = ecryptfs_truncate(file->f_path.dentry, |
295 | prev_page_end_size); | 347 | prev_page_end_size); |
296 | if (rc) { | 348 | if (rc) { |
297 | printk(KERN_ERR "Error on attempt to " | 349 | printk(KERN_ERR "%s: Error on attempt to " |
298 | "truncate to (higher) offset [%lld];" | 350 | "truncate to (higher) offset [%lld];" |
299 | " rc = [%d]\n", prev_page_end_size, rc); | 351 | " rc = [%d]\n", __FUNCTION__, |
352 | prev_page_end_size, rc); | ||
300 | goto out; | 353 | goto out; |
301 | } | 354 | } |
302 | } | 355 | } |
303 | } | 356 | } |
304 | /* | 357 | /* Writing to a new page, and creating a small hole from start |
305 | * Writing to a new page, and creating a small hole from start of page? | 358 | * of page? Zero it out. */ |
306 | * Zero it out. | 359 | if ((i_size_read(page->mapping->host) == prev_page_end_size) |
307 | */ | 360 | && (from != 0)) |
308 | if ((i_size_read(page->mapping->host) == prev_page_end_size) && | ||
309 | (from != 0)) { | ||
310 | zero_user(page, 0, PAGE_CACHE_SIZE); | 361 | zero_user(page, 0, PAGE_CACHE_SIZE); |
311 | } | ||
312 | out: | 362 | out: |
313 | return rc; | 363 | return rc; |
314 | } | 364 | } |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 18769cc32377..ad5360664082 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -806,8 +806,8 @@ static match_table_t tokens = { | |||
806 | {Opt_quota, "quota"}, | 806 | {Opt_quota, "quota"}, |
807 | {Opt_usrquota, "usrquota"}, | 807 | {Opt_usrquota, "usrquota"}, |
808 | {Opt_barrier, "barrier=%u"}, | 808 | {Opt_barrier, "barrier=%u"}, |
809 | {Opt_err, NULL}, | ||
810 | {Opt_resize, "resize"}, | 809 | {Opt_resize, "resize"}, |
810 | {Opt_err, NULL}, | ||
811 | }; | 811 | }; |
812 | 812 | ||
813 | static ext3_fsblk_t get_sb_block(void **data) | 813 | static ext3_fsblk_t get_sb_block(void **data) |
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 6841452e0dea..393cc22c1717 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
@@ -2031,7 +2031,7 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, | |||
2031 | return -EXDEV; | 2031 | return -EXDEV; |
2032 | } | 2032 | } |
2033 | /* We must not pack tails for quota files on reiserfs for quota IO to work */ | 2033 | /* We must not pack tails for quota files on reiserfs for quota IO to work */ |
2034 | if (!REISERFS_I(nd.path.dentry->d_inode)->i_flags & i_nopack_mask) { | 2034 | if (!(REISERFS_I(nd.path.dentry->d_inode)->i_flags & i_nopack_mask)) { |
2035 | reiserfs_warning(sb, | 2035 | reiserfs_warning(sb, |
2036 | "reiserfs: Quota file must have tail packing disabled."); | 2036 | "reiserfs: Quota file must have tail packing disabled."); |
2037 | path_put(&nd.path); | 2037 | path_put(&nd.path); |