Pull misc vfs updates from Al Viro: "Assorted bits and pieces from various people. No common topic in this pile, sorry" * 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: fs/affs: add rename exchange fs/affs: add rename2 to prepare multiple methods Make stat/lstat/fstatat pass AT_NO_AUTOMOUNT to vfs_statx() fs: don't set *REFERENCED on single use objects fs: compat: Remove warning from COMPATIBLE_IOCTL remove pointless extern of atime_need_update_rcu() fs: completely ignore unknown open flags fs: add a VALID_OPEN_FLAGS fs: remove _submit_bh() fs: constify tree_descr arrays passed to simple_fill_super() fs: drop duplicate header percpu-rwsem.h fs/affs: bugfix: Write files greater than page size on OFS fs/affs: bugfix: enable writes on OFS disks fs/affs: remove node generation check fs/affs: import amigaffs.h fs/affs: bugfix: make symbolic links work again
Unified · Split
| @@ -512,7 +512,7 @@ static int qibfs_fill_super(struct super_block *sb, void *data, int silent) · 511 unmodified lines | |||
| 512 | unsigned long flags; | 512 | unsigned long flags; |
| 513 | int ret; | 513 | int ret; |
| 514 | 514 | ||
| 515 | static struct tree_descr files[] = { | 515 | static const struct tree_descr files[] = { |
| 516 | [2] = {"driver_stats", &driver_ops[0], S_IRUGO}, | 516 | [2] = {"driver_stats", &driver_ops[0], S_IRUGO}, |
| 517 | [3] = {"driver_stats_names", &driver_ops[1], S_IRUGO}, | 517 | [3] = {"driver_stats_names", &driver_ops[1], S_IRUGO}, |
| 518 | {""}, | 518 | {""}, |
| @@ -44,14 +44,14 @@ static const struct file_operations capabilities_file_ops = { · 43 unmodified lines | |||
| 44 | 44 | ||
| 45 | static int xenfs_fill_super(struct super_block *sb, void *data, int silent) | 45 | static int xenfs_fill_super(struct super_block *sb, void *data, int silent) |
| 46 | { | 46 | { |
| 47 | static struct tree_descr xenfs_files[] = { | 47 | static const struct tree_descr xenfs_files[] = { |
| 48 | [2] = { "xenbus", &xen_xenbus_fops, S_IRUSR|S_IWUSR }, | 48 | [2] = { "xenbus", &xen_xenbus_fops, S_IRUSR|S_IWUSR }, |
| 49 | { "capabilities", &capabilities_file_ops, S_IRUGO }, | 49 | { "capabilities", &capabilities_file_ops, S_IRUGO }, |
| 50 | { "privcmd", &xen_privcmd_fops, S_IRUSR|S_IWUSR }, | 50 | { "privcmd", &xen_privcmd_fops, S_IRUSR|S_IWUSR }, |
| 51 | {""}, | 51 | {""}, |
| 52 | }; | 52 | }; |
| 53 | 53 | ||
| 54 | static struct tree_descr xenfs_init_files[] = { | 54 | static const struct tree_descr xenfs_init_files[] = { |
| 55 | [2] = { "xenbus", &xen_xenbus_fops, S_IRUSR|S_IWUSR }, | 55 | [2] = { "xenbus", &xen_xenbus_fops, S_IRUSR|S_IWUSR }, |
| 56 | { "capabilities", &capabilities_file_ops, S_IRUGO }, | 56 | { "capabilities", &capabilities_file_ops, S_IRUGO }, |
| 57 | { "privcmd", &xen_privcmd_fops, S_IRUSR|S_IWUSR }, | 57 | { "privcmd", &xen_privcmd_fops, S_IRUSR|S_IWUSR }, |
| @@ -7,7 +7,7 @@ · 6 unmodified lines | |||
| 7 | #include <linux/types.h> | 7 | #include <linux/types.h> |
| 8 | #include <linux/fs.h> | 8 | #include <linux/fs.h> |
| 9 | #include <linux/buffer_head.h> | 9 | #include <linux/buffer_head.h> |
| 10 | #include <linux/amigaffs.h> | 10 | #include "amigaffs.h" |
| 11 | #include <linux/mutex.h> | 11 | #include <linux/mutex.h> |
| 12 | #include <linux/workqueue.h> | 12 | #include <linux/workqueue.h> |
| 13 | 13 | ||
| @@ -173,7 +173,7 @@ extern int affs_link(struct dentry *olddentry, struct inode *dir, · 159 unmodified lines | |||
| 173 | struct dentry *dentry); | 173 | struct dentry *dentry); |
| 174 | extern int affs_symlink(struct inode *dir, struct dentry *dentry, | 174 | extern int affs_symlink(struct inode *dir, struct dentry *dentry, |
| 175 | const char *symname); | 175 | const char *symname); |
| 176 | extern int affs_rename(struct inode *old_dir, struct dentry *old_dentry, | 176 | extern int affs_rename2(struct inode *old_dir, struct dentry *old_dentry, |
| 177 | struct inode *new_dir, struct dentry *new_dentry, | 177 | struct inode *new_dir, struct dentry *new_dentry, |
| 178 | unsigned int flags); | 178 | unsigned int flags); |
| 179 | 179 | ||
File renamed without changes.
| @@ -35,7 +35,7 @@ const struct inode_operations affs_dir_inode_operations = { · 34 unmodified lines | |||
| 35 | .symlink = affs_symlink, | 35 | .symlink = affs_symlink, |
| 36 | .mkdir = affs_mkdir, | 36 | .mkdir = affs_mkdir, |
| 37 | .rmdir = affs_rmdir, | 37 | .rmdir = affs_rmdir, |
| 38 | .rename = affs_rename, | 38 | .rename = affs_rename2, |
| 39 | .setattr = affs_notify_change, | 39 | .setattr = affs_notify_change, |
| 40 | }; | 40 | }; |
| 41 | 41 | ||
| @@ -499,7 +499,7 @@ affs_getemptyblk_ino(struct inode *inode, int block) · 498 unmodified lines | |||
| 499 | } | 499 | } |
| 500 | 500 | ||
| 501 | static int | 501 | static int |
| 502 | affs_do_readpage_ofs(struct page *page, unsigned to) | 502 | affs_do_readpage_ofs(struct page *page, unsigned to, int create) |
| 503 | { | 503 | { |
| 504 | struct inode *inode = page->mapping->host; | 504 | struct inode *inode = page->mapping->host; |
| 505 | struct super_block *sb = inode->i_sb; | 505 | struct super_block *sb = inode->i_sb; |
| @@ -518,7 +518,7 @@ affs_do_readpage_ofs(struct page *page, unsigned to) · 12 unmodified lines | |||
| 518 | boff = tmp % bsize; | 518 | boff = tmp % bsize; |
| 519 | 519 | ||
| 520 | while (pos < to) { | 520 | while (pos < to) { |
| 521 | bh = affs_bread_ino(inode, bidx, 0); | 521 | bh = affs_bread_ino(inode, bidx, create); |
| 522 | if (IS_ERR(bh)) | 522 | if (IS_ERR(bh)) |
| 523 | return PTR_ERR(bh); | 523 | return PTR_ERR(bh); |
| 524 | tmp = min(bsize - boff, to - pos); | 524 | tmp = min(bsize - boff, to - pos); |
| @@ -620,7 +620,7 @@ affs_readpage_ofs(struct file *file, struct page *page) · 95 unmodified lines | |||
| 620 | memset(page_address(page) + to, 0, PAGE_SIZE - to); | 620 | memset(page_address(page) + to, 0, PAGE_SIZE - to); |
| 621 | } | 621 | } |
| 622 | 622 | ||
| 623 | err = affs_do_readpage_ofs(page, to); | 623 | err = affs_do_readpage_ofs(page, to, 0); |
| 624 | if (!err) | 624 | if (!err) |
| 625 | SetPageUptodate(page); | 625 | SetPageUptodate(page); |
| 626 | unlock_page(page); | 626 | unlock_page(page); |
| @@ -657,7 +657,7 @@ static int affs_write_begin_ofs(struct file *file, struct address_space *mapping · 30 unmodified lines | |||
| 657 | return 0; | 657 | return 0; |
| 658 | 658 | ||
| 659 | /* XXX: inefficient but safe in the face of short writes */ | 659 | /* XXX: inefficient but safe in the face of short writes */ |
| 660 | err = affs_do_readpage_ofs(page, PAGE_SIZE); | 660 | err = affs_do_readpage_ofs(page, PAGE_SIZE, 1); |
| 661 | if (err) { | 661 | if (err) { |
| 662 | unlock_page(page); | 662 | unlock_page(page); |
| 663 | put_page(page); | 663 | put_page(page); |
| @@ -679,7 +679,7 @@ static int affs_write_end_ofs(struct file *file, struct address_space *mapping, · 15 unmodified lines | |||
| 679 | int written; | 679 | int written; |
| 680 | 680 | ||
| 681 | from = pos & (PAGE_SIZE - 1); | 681 | from = pos & (PAGE_SIZE - 1); |
| 682 | to = pos + len; | 682 | to = from + len; |
| 683 | /* | 683 | /* |
| 684 | * XXX: not sure if this can handle short copies (len < copied), but | 684 | * XXX: not sure if this can handle short copies (len < copied), but |
| 685 | * we don't have to, because the page should always be uptodate here, | 685 | * we don't have to, because the page should always be uptodate here, |
| @@ -140,6 +140,7 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino) · 139 unmodified lines | |||
| 140 | inode->i_fop = &affs_file_operations; | 140 | inode->i_fop = &affs_file_operations; |
| 141 | break; | 141 | break; |
| 142 | case ST_SOFTLINK: | 142 | case ST_SOFTLINK: |
| 143 | inode->i_size = strlen((char *)AFFS_HEAD(bh)->table); | ||
| 143 | inode->i_mode |= S_IFLNK; | 144 | inode->i_mode |= S_IFLNK; |
| 144 | inode_nohighmem(inode); | 145 | inode_nohighmem(inode); |
| 145 | inode->i_op = &affs_symlink_inode_operations; | 146 | inode->i_op = &affs_symlink_inode_operations; |
| @@ -365,6 +365,7 @@ affs_symlink(struct inode *dir, struct dentry *dentry, const char *symname) · 364 unmodified lines | |||
| 365 | symname++; | 365 | symname++; |
| 366 | } | 366 | } |
| 367 | *p = 0; | 367 | *p = 0; |
| 368 | inode->i_size = i + 1; | ||
| 368 | mark_buffer_dirty_inode(bh, inode); | 369 | mark_buffer_dirty_inode(bh, inode); |
| 369 | affs_brelse(bh); | 370 | affs_brelse(bh); |
| 370 | mark_inode_dirty(inode); | 371 | mark_inode_dirty(inode); |
| @@ -393,21 +394,14 @@ affs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) · 22 unmodified lines | |||
| 393 | return affs_add_entry(dir, inode, dentry, ST_LINKFILE); | 394 | return affs_add_entry(dir, inode, dentry, ST_LINKFILE); |
| 394 | } | 395 | } |
| 395 | 396 | ||
| 396 | int | 397 | static int |
| 397 | affs_rename(struct inode *old_dir, struct dentry *old_dentry, | 398 | affs_rename(struct inode *old_dir, struct dentry *old_dentry, |
| 398 | struct inode *new_dir, struct dentry *new_dentry, | 399 | struct inode *new_dir, struct dentry *new_dentry) |
| 399 | unsigned int flags) | ||
| 400 | { | 400 | { |
| 401 | struct super_block *sb = old_dir->i_sb; | 401 | struct super_block *sb = old_dir->i_sb; |
| 402 | struct buffer_head *bh = NULL; | 402 | struct buffer_head *bh = NULL; |
| 403 | int retval; | 403 | int retval; |
| 404 | 404 | ||
| 405 | if (flags & ~RENAME_NOREPLACE) | ||
| 406 | return -EINVAL; | ||
| 407 | |||
| 408 | pr_debug("%s(old=%lu,\"%pd\" to new=%lu,\"%pd\")\n", __func__, | ||
| 409 | old_dir->i_ino, old_dentry, new_dir->i_ino, new_dentry); | ||
| 410 | |||
| 411 | retval = affs_check_name(new_dentry->d_name.name, | 405 | retval = affs_check_name(new_dentry->d_name.name, |
| 412 | new_dentry->d_name.len, | 406 | new_dentry->d_name.len, |
| 413 | affs_nofilenametruncate(old_dentry)); | 407 | affs_nofilenametruncate(old_dentry)); |
| @@ -447,6 +441,76 @@ done: · 33 unmodified lines | |||
| 447 | return retval; | 441 | return retval; |
| 448 | } | 442 | } |
| 449 | 443 | ||
| 444 | static int | ||
| 445 | affs_xrename(struct inode *old_dir, struct dentry *old_dentry, | ||
| 446 | struct inode *new_dir, struct dentry *new_dentry) | ||
| 447 | { | ||
| 448 | |||
| 449 | struct super_block *sb = old_dir->i_sb; | ||
| 450 | struct buffer_head *bh_old = NULL; | ||
| 451 | struct buffer_head *bh_new = NULL; | ||
| 452 | int retval; | ||
| 453 | |||
| 454 | bh_old = affs_bread(sb, d_inode(old_dentry)->i_ino); | ||
| 455 | if (!bh_old) | ||
| 456 | return -EIO; | ||
| 457 | |||
| 458 | bh_new = affs_bread(sb, d_inode(new_dentry)->i_ino); | ||
| 459 | if (!bh_new) | ||
| 460 | return -EIO; | ||
| 461 | |||
| 462 | /* Remove old header from its parent directory. */ | ||
| 463 | affs_lock_dir(old_dir); | ||
| 464 | retval = affs_remove_hash(old_dir, bh_old); | ||
| 465 | affs_unlock_dir(old_dir); | ||
| 466 | if (retval) | ||
| 467 | goto done; | ||
| 468 | |||
| 469 | /* Remove new header from its parent directory. */ | ||
| 470 | affs_lock_dir(new_dir); | ||
| 471 | retval = affs_remove_hash(new_dir, bh_new); | ||
| 472 | affs_unlock_dir(new_dir); | ||
| 473 | if (retval) | ||
| 474 | goto done; | ||
| 475 | |||
| 476 | /* Insert old into the new directory with the new name. */ | ||
| 477 | affs_copy_name(AFFS_TAIL(sb, bh_old)->name, new_dentry); | ||
| 478 | affs_fix_checksum(sb, bh_old); | ||
| 479 | affs_lock_dir(new_dir); | ||
| 480 | retval = affs_insert_hash(new_dir, bh_old); | ||
| 481 | affs_unlock_dir(new_dir); | ||
| 482 | |||
| 483 | /* Insert new into the old directory with the old name. */ | ||
| 484 | affs_copy_name(AFFS_TAIL(sb, bh_new)->name, old_dentry); | ||
| 485 | affs_fix_checksum(sb, bh_new); | ||
| 486 | affs_lock_dir(old_dir); | ||
| 487 | retval = affs_insert_hash(old_dir, bh_new); | ||
| 488 | affs_unlock_dir(old_dir); | ||
| 489 | done: | ||
| 490 | mark_buffer_dirty_inode(bh_old, new_dir); | ||
| 491 | mark_buffer_dirty_inode(bh_new, old_dir); | ||
| 492 | affs_brelse(bh_old); | ||
| 493 | affs_brelse(bh_new); | ||
| 494 | return retval; | ||
| 495 | } | ||
| 496 | |||
| 497 | int affs_rename2(struct inode *old_dir, struct dentry *old_dentry, | ||
| 498 | struct inode *new_dir, struct dentry *new_dentry, | ||
| 499 | unsigned int flags) | ||
| 500 | { | ||
| 501 | |||
| 502 | if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE)) | ||
| 503 | return -EINVAL; | ||
| 504 | |||
| 505 | pr_debug("%s(old=%lu,\"%pd\" to new=%lu,\"%pd\")\n", __func__, | ||
| 506 | old_dir->i_ino, old_dentry, new_dir->i_ino, new_dentry); | ||
| 507 | |||
| 508 | if (flags & RENAME_EXCHANGE) | ||
| 509 | return affs_xrename(old_dir, old_dentry, new_dir, new_dentry); | ||
| 510 | |||
| 511 | return affs_rename(old_dir, old_dentry, new_dir, new_dentry); | ||
| 512 | } | ||
| 513 | |||
| 450 | static struct dentry *affs_get_parent(struct dentry *child) | 514 | static struct dentry *affs_get_parent(struct dentry *child) |
| 451 | { | 515 | { |
| 452 | struct inode *parent; | 516 | struct inode *parent; |
| @@ -477,11 +541,6 @@ static struct inode *affs_nfs_get_inode(struct super_block *sb, u64 ino, · 24 unmodified lines | |||
| 477 | if (IS_ERR(inode)) | 541 | if (IS_ERR(inode)) |
| 478 | return ERR_CAST(inode); | 542 | return ERR_CAST(inode); |
| 479 | 543 | ||
| 480 | if (generation && inode->i_generation != generation) { | ||
| 481 | iput(inode); | ||
| 482 | return ERR_PTR(-ESTALE); | ||
| 483 | } | ||
| 484 | |||
| 485 | return inode; | 544 | return inode; |
| 486 | } | 545 | } |
| 487 | 546 | ||
| @@ -818,7 +818,7 @@ static const struct super_operations s_ops = { · 817 unmodified lines | |||
| 818 | static int bm_fill_super(struct super_block *sb, void *data, int silent) | 818 | static int bm_fill_super(struct super_block *sb, void *data, int silent) |
| 819 | { | 819 | { |
| 820 | int err; | 820 | int err; |
| 821 | static struct tree_descr bm_files[] = { | 821 | static const struct tree_descr bm_files[] = { |
| 822 | [2] = {"status", &bm_status_operations, S_IWUSR|S_IRUGO}, | 822 | [2] = {"status", &bm_status_operations, S_IWUSR|S_IRUGO}, |
| 823 | [3] = {"register", &bm_register_operations, S_IWUSR}, | 823 | [3] = {"register", &bm_register_operations, S_IWUSR}, |
| 824 | /* last one */ {""} | 824 | /* last one */ {""} |
| @@ -49,7 +49,6 @@ · 48 unmodified lines | |||
| 49 | 49 | ||
| 50 | static int fsync_buffers_list(spinlock_t *lock, struct list_head *list); | 50 | static int fsync_buffers_list(spinlock_t *lock, struct list_head *list); |
| 51 | static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh, | 51 | static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh, |
| 52 | unsigned long bio_flags, | ||
| 53 | struct writeback_control *wbc); | 52 | struct writeback_control *wbc); |
| 54 | 53 | ||
| 55 | #define BH_ENTRY(list) list_entry((list), struct buffer_head, b_assoc_buffers) | 54 | #define BH_ENTRY(list) list_entry((list), struct buffer_head, b_assoc_buffers) |
| @@ -1830,7 +1829,7 @@ int __block_write_full_page(struct inode *inode, struct page *page, · 1774 unmodified lines | |||
| 1830 | do { | 1829 | do { |
| 1831 | struct buffer_head *next = bh->b_this_page; | 1830 | struct buffer_head *next = bh->b_this_page; |
| 1832 | if (buffer_async_write(bh)) { | 1831 | if (buffer_async_write(bh)) { |
| 1833 | submit_bh_wbc(REQ_OP_WRITE, write_flags, bh, 0, wbc); | 1832 | submit_bh_wbc(REQ_OP_WRITE, write_flags, bh, wbc); |
| 1834 | nr_underway++; | 1833 | nr_underway++; |
| 1835 | } | 1834 | } |
| 1836 | bh = next; | 1835 | bh = next; |
| @@ -1884,7 +1883,7 @@ recover: · 47 unmodified lines | |||
| 1884 | struct buffer_head *next = bh->b_this_page; | 1883 | struct buffer_head *next = bh->b_this_page; |
| 1885 | if (buffer_async_write(bh)) { | 1884 | if (buffer_async_write(bh)) { |
| 1886 | clear_buffer_dirty(bh); | 1885 | clear_buffer_dirty(bh); |
| 1887 | submit_bh_wbc(REQ_OP_WRITE, write_flags, bh, 0, wbc); | 1886 | submit_bh_wbc(REQ_OP_WRITE, write_flags, bh, wbc); |
| 1888 | nr_underway++; | 1887 | nr_underway++; |
| 1889 | } | 1888 | } |
| 1890 | bh = next; | 1889 | bh = next; |
| @@ -3092,7 +3091,7 @@ void guard_bio_eod(int op, struct bio *bio) · 1201 unmodified lines | |||
| 3092 | } | 3091 | } |
| 3093 | 3092 | ||
| 3094 | static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh, | 3093 | static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh, |
| 3095 | unsigned long bio_flags, struct writeback_control *wbc) | 3094 | struct writeback_control *wbc) |
| 3096 | { | 3095 | { |
| 3097 | struct bio *bio; | 3096 | struct bio *bio; |
| 3098 | 3097 | ||
| @@ -3127,7 +3126,6 @@ static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh, · 28 unmodified lines | |||
| 3127 | 3126 | ||
| 3128 | bio->bi_end_io = end_bio_bh_io_sync; | 3127 | bio->bi_end_io = end_bio_bh_io_sync; |
| 3129 | bio->bi_private = bh; | 3128 | bio->bi_private = bh; |
| 3130 | bio->bi_flags |= bio_flags; | ||
| 3131 | 3129 | ||
| 3132 | /* Take care of bh's that straddle the end of the device */ | 3130 | /* Take care of bh's that straddle the end of the device */ |
| 3133 | guard_bio_eod(op, bio); | 3131 | guard_bio_eod(op, bio); |
| @@ -3142,16 +3140,9 @@ static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh, · 8 unmodified lines | |||
| 3142 | return 0; | 3140 | return 0; |
| 3143 | } | 3141 | } |
| 3144 | 3142 | ||
| 3145 | int _submit_bh(int op, int op_flags, struct buffer_head *bh, | 3143 | int submit_bh(int op, int op_flags, struct buffer_head *bh) |
| 3146 | unsigned long bio_flags) | ||
| 3147 | { | 3144 | { |
| 3148 | return submit_bh_wbc(op, op_flags, bh, bio_flags, NULL); | 3145 | return submit_bh_wbc(op, op_flags, bh, NULL); |
| 3149 | } | ||
| 3150 | EXPORT_SYMBOL_GPL(_submit_bh); | ||
| 3151 | |||
| 3152 | int submit_bh(int op, int op_flags, struct buffer_head *bh) | ||
| 3153 | { | ||
| 3154 | return submit_bh_wbc(op, op_flags, bh, 0, NULL); | ||
| 3155 | } | 3146 | } |
| 3156 | EXPORT_SYMBOL(submit_bh); | 3147 | EXPORT_SYMBOL(submit_bh); |
| 3157 | 3148 | ||
| @@ -833,7 +833,7 @@ static int compat_ioctl_preallocate(struct file *file, · 832 unmodified lines | |||
| 833 | */ | 833 | */ |
| 834 | #define XFORM(i) (((i) ^ ((i) << 27) ^ ((i) << 17)) & 0xffffffff) | 834 | #define XFORM(i) (((i) ^ ((i) << 27) ^ ((i) << 17)) & 0xffffffff) |
| 835 | 835 | ||
| 836 | #define COMPATIBLE_IOCTL(cmd) XFORM(cmd), | 836 | #define COMPATIBLE_IOCTL(cmd) XFORM((u32)cmd), |
| 837 | /* ioctl should not be warned about even if it's not implemented. | 837 | /* ioctl should not be warned about even if it's not implemented. |
| 838 | Valid reasons to use this: | 838 | Valid reasons to use this: |
| 839 | - It is implemented with ->compat_ioctl on some device, but programs | 839 | - It is implemented with ->compat_ioctl on some device, but programs |
| @@ -419,6 +419,8 @@ static void dentry_lru_add(struct dentry *dentry) · 418 unmodified lines | |||
| 419 | { | 419 | { |
| 420 | if (unlikely(!(dentry->d_flags & DCACHE_LRU_LIST))) | 420 | if (unlikely(!(dentry->d_flags & DCACHE_LRU_LIST))) |
| 421 | d_lru_add(dentry); | 421 | d_lru_add(dentry); |
| 422 | else if (unlikely(!(dentry->d_flags & DCACHE_REFERENCED))) | ||
| 423 | dentry->d_flags |= DCACHE_REFERENCED; | ||
| 422 | } | 424 | } |
| 423 | 425 | ||
| 424 | /** | 426 | /** |
| @@ -779,8 +781,6 @@ repeat: · 354 unmodified lines | |||
| 779 | goto kill_it; | 781 | goto kill_it; |
| 780 | } | 782 | } |
| 781 | 783 | ||
| 782 | if (!(dentry->d_flags & DCACHE_REFERENCED)) | ||
| 783 | dentry->d_flags |= DCACHE_REFERENCED; | ||
| 784 | dentry_lru_add(dentry); | 784 | dentry_lru_add(dentry); |
| 785 | 785 | ||
| 786 | dentry->d_lockref.count--; | 786 | dentry->d_lockref.count--; |
| @@ -199,7 +199,7 @@ static const struct dentry_operations debugfs_dops = { · 198 unmodified lines | |||
| 199 | 199 | ||
| 200 | static int debug_fill_super(struct super_block *sb, void *data, int silent) | 200 | static int debug_fill_super(struct super_block *sb, void *data, int silent) |
| 201 | { | 201 | { |
| 202 | static struct tree_descr debug_files[] = {{""}}; | 202 | static const struct tree_descr debug_files[] = {{""}}; |
| 203 | struct debugfs_fs_info *fsi; | 203 | struct debugfs_fs_info *fsi; |
| 204 | int err; | 204 | int err; |
| 205 | 205 | ||
| @@ -899,16 +899,10 @@ static int __init fcntl_init(void) · 898 unmodified lines | |||
| 899 | * Exceptions: O_NONBLOCK is a two bit define on parisc; O_NDELAY | 899 | * Exceptions: O_NONBLOCK is a two bit define on parisc; O_NDELAY |
| 900 | * is defined as O_NONBLOCK on some platforms and not on others. | 900 | * is defined as O_NONBLOCK on some platforms and not on others. |
| 901 | */ | 901 | */ |
| 902 | BUILD_BUG_ON(21 - 1 /* for O_RDONLY being 0 */ != HWEIGHT32( | 902 | BUILD_BUG_ON(21 - 1 /* for O_RDONLY being 0 */ != |
| 903 | O_RDONLY | O_WRONLY | O_RDWR | | 903 | HWEIGHT32( |
| 904 | O_CREAT | O_EXCL | O_NOCTTY | | 904 | (VALID_OPEN_FLAGS & ~(O_NONBLOCK | O_NDELAY)) | |
| 905 | O_TRUNC | O_APPEND | /* O_NONBLOCK | */ | 905 | __FMODE_EXEC | __FMODE_NONOTIFY)); |
| 906 | __O_SYNC | O_DSYNC | FASYNC | | ||
| 907 | O_DIRECT | O_LARGEFILE | O_DIRECTORY | | ||
| 908 | O_NOFOLLOW | O_NOATIME | O_CLOEXEC | | ||
| 909 | __FMODE_EXEC | O_PATH | __O_TMPFILE | | ||
| 910 | __FMODE_NONOTIFY | ||
| 911 | )); | ||
| 912 | 906 | ||
| 913 | fasync_cache = kmem_cache_create("fasync_cache", | 907 | fasync_cache = kmem_cache_create("fasync_cache", |
| 914 | sizeof(struct fasync_struct), 0, SLAB_PANIC, NULL); | 908 | sizeof(struct fasync_struct), 0, SLAB_PANIC, NULL); |
| @@ -292,7 +292,7 @@ void fuse_ctl_remove_conn(struct fuse_conn *fc) · 291 unmodified lines | |||
| 292 | 292 | ||
| 293 | static int fuse_ctl_fill_super(struct super_block *sb, void *data, int silent) | 293 | static int fuse_ctl_fill_super(struct super_block *sb, void *data, int silent) |
| 294 | { | 294 | { |
| 295 | struct tree_descr empty_descr = {""}; | 295 | static const struct tree_descr empty_descr = {""}; |
| 296 | struct fuse_conn *fc; | 296 | struct fuse_conn *fc; |
| 297 | int err; | 297 | int err; |
| 298 | 298 | ||
| @@ -402,6 +402,8 @@ static void inode_lru_list_add(struct inode *inode) · 401 unmodified lines | |||
| 402 | { | 402 | { |
| 403 | if (list_lru_add(&inode->i_sb->s_inode_lru, &inode->i_lru)) | 403 | if (list_lru_add(&inode->i_sb->s_inode_lru, &inode->i_lru)) |
| 404 | this_cpu_inc(nr_unused); | 404 | this_cpu_inc(nr_unused); |
| 405 | else | ||
| 406 | inode->i_state |= I_REFERENCED; | ||
| 405 | } | 407 | } |
| 406 | 408 | ||
| 407 | /* | 409 | /* |
| @@ -1489,7 +1491,6 @@ static void iput_final(struct inode *inode) · 1081 unmodified lines | |||
| 1489 | drop = generic_drop_inode(inode); | 1491 | drop = generic_drop_inode(inode); |
| 1490 | 1492 | ||
| 1491 | if (!drop && (sb->s_flags & MS_ACTIVE)) { | 1493 | if (!drop && (sb->s_flags & MS_ACTIVE)) { |
| 1492 | inode->i_state |= I_REFERENCED; | ||
| 1493 | inode_add_lru(inode); | 1494 | inode_add_lru(inode); |
| 1494 | spin_unlock(&inode->i_lock); | 1495 | spin_unlock(&inode->i_lock); |
| 1495 | return; | 1496 | return; |
| @@ -126,8 +126,6 @@ static inline bool atime_needs_update_rcu(const struct path *path, · 125 unmodified lines | |||
| 126 | return __atime_needs_update(path, inode, true); | 126 | return __atime_needs_update(path, inode, true); |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | extern bool atime_needs_update_rcu(const struct path *, struct inode *); | ||
| 130 | |||
| 131 | /* | 129 | /* |
| 132 | * fs-writeback.c | 130 | * fs-writeback.c |
| 133 | */ | 131 | */ |
| @@ -507,7 +507,7 @@ EXPORT_SYMBOL(simple_write_end); · 506 unmodified lines | |||
| 507 | * to pass it an appropriate max_reserved value to avoid collisions. | 507 | * to pass it an appropriate max_reserved value to avoid collisions. |
| 508 | */ | 508 | */ |
| 509 | int simple_fill_super(struct super_block *s, unsigned long magic, | 509 | int simple_fill_super(struct super_block *s, unsigned long magic, |
| 510 | struct tree_descr *files) | 510 | const struct tree_descr *files) |
| 511 | { | 511 | { |
| 512 | struct inode *inode; | 512 | struct inode *inode; |
| 513 | struct dentry *root; | 513 | struct dentry *root; |
| @@ -1146,7 +1146,7 @@ static ssize_t write_v4_end_grace(struct file *file, char *buf, size_t size) · 1145 unmodified lines | |||
| 1146 | 1146 | ||
| 1147 | static int nfsd_fill_super(struct super_block * sb, void * data, int silent) | 1147 | static int nfsd_fill_super(struct super_block * sb, void * data, int silent) |
| 1148 | { | 1148 | { |
| 1149 | static struct tree_descr nfsd_files[] = { | 1149 | static const struct tree_descr nfsd_files[] = { |
| 1150 | [NFSD_List] = {"exports", &exports_nfsd_operations, S_IRUGO}, | 1150 | [NFSD_List] = {"exports", &exports_nfsd_operations, S_IRUGO}, |
| 1151 | [NFSD_Export_features] = {"export_features", | 1151 | [NFSD_Export_features] = {"export_features", |
| 1152 | &export_features_operations, S_IRUGO}, | 1152 | &export_features_operations, S_IRUGO}, |
| @@ -900,6 +900,12 @@ static inline int build_open_flags(int flags, umode_t mode, struct open_flags *o · 899 unmodified lines | |||
| 900 | int lookup_flags = 0; | 900 | int lookup_flags = 0; |
| 901 | int acc_mode = ACC_MODE(flags); | 901 | int acc_mode = ACC_MODE(flags); |
| 902 | 902 | ||
| 903 | /* | ||
| 904 | * Clear out all open flags we don't know about so that we don't report | ||
| 905 | * them in fcntl(F_GETFD) or similar interfaces. | ||
| 906 | */ | ||
| 907 | flags &= VALID_OPEN_FLAGS; | ||
| 908 | |||
| 903 | if (flags & (O_CREAT | __O_TMPFILE)) | 909 | if (flags & (O_CREAT | __O_TMPFILE)) |
| 904 | op->mode = (mode & S_IALLUGO) | S_IFREG; | 910 | op->mode = (mode & S_IALLUGO) | S_IFREG; |
| 905 | else | 911 | else |
| @@ -266,7 +266,7 @@ static const struct super_operations tracefs_super_operations = { · 265 unmodified lines | |||
| 266 | 266 | ||
| 267 | static int trace_fill_super(struct super_block *sb, void *data, int silent) | 267 | static int trace_fill_super(struct super_block *sb, void *data, int silent) |
| 268 | { | 268 | { |
| 269 | static struct tree_descr trace_files[] = {{""}}; | 269 | static const struct tree_descr trace_files[] = {{""}}; |
| 270 | struct tracefs_fs_info *fsi; | 270 | struct tracefs_fs_info *fsi; |
| 271 | int err; | 271 | int err; |
| 272 | 272 | ||
| @@ -196,8 +196,6 @@ void ll_rw_block(int, int, int, struct buffer_head * bh[]); · 195 unmodified lines | |||
| 196 | int sync_dirty_buffer(struct buffer_head *bh); | 196 | int sync_dirty_buffer(struct buffer_head *bh); |
| 197 | int __sync_dirty_buffer(struct buffer_head *bh, int op_flags); | 197 | int __sync_dirty_buffer(struct buffer_head *bh, int op_flags); |
| 198 | void write_dirty_buffer(struct buffer_head *bh, int op_flags); | 198 | void write_dirty_buffer(struct buffer_head *bh, int op_flags); |
| 199 | int _submit_bh(int op, int op_flags, struct buffer_head *bh, | ||
| 200 | unsigned long bio_flags); | ||
| 201 | int submit_bh(int, int, struct buffer_head *); | 199 | int submit_bh(int, int, struct buffer_head *); |
| 202 | void write_boundary_block(struct block_device *bdev, | 200 | void write_boundary_block(struct block_device *bdev, |
| 203 | sector_t bblock, unsigned blocksize); | 201 | sector_t bblock, unsigned blocksize); |
| @@ -3,6 +3,12 @@ · 2 unmodified lines | |||
| 3 | 3 | ||
| 4 | #include <uapi/linux/fcntl.h> | 4 | #include <uapi/linux/fcntl.h> |
| 5 | 5 | ||
| 6 | /* list of all valid flags for the open/openat flags argument: */ | ||
| 7 | #define VALID_OPEN_FLAGS \ | ||
| 8 | (O_RDONLY | O_WRONLY | O_RDWR | O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC | \ | ||
| 9 | O_APPEND | O_NDELAY | O_NONBLOCK | O_NDELAY | __O_SYNC | O_DSYNC | \ | ||
| 10 | FASYNC | O_DIRECT | O_LARGEFILE | O_DIRECTORY | O_NOFOLLOW | \ | ||
| 11 | O_NOATIME | O_CLOEXEC | O_PATH | __O_TMPFILE) | ||
| 6 | 12 | ||
| 7 | #ifndef force_o_largefile | 13 | #ifndef force_o_largefile |
| 8 | #define force_o_largefile() (BITS_PER_LONG != 32) | 14 | #define force_o_largefile() (BITS_PER_LONG != 32) |
| @@ -29,7 +29,6 @@ · 28 unmodified lines | |||
| 29 | #include <linux/lockdep.h> | 29 | #include <linux/lockdep.h> |
| 30 | #include <linux/percpu-rwsem.h> | 30 | #include <linux/percpu-rwsem.h> |
| 31 | #include <linux/workqueue.h> | 31 | #include <linux/workqueue.h> |
| 32 | #include <linux/percpu-rwsem.h> | ||
| 33 | #include <linux/delayed_call.h> | 32 | #include <linux/delayed_call.h> |
| 34 | 33 | ||
| 35 | #include <asm/byteorder.h> | 34 | #include <asm/byteorder.h> |
| @@ -2925,17 +2924,19 @@ extern int vfs_statx_fd(unsigned int, struct kstat *, u32, unsigned int); · 2889 unmodified lines | |||
| 2925 | 2924 | ||
| 2926 | static inline int vfs_stat(const char __user *filename, struct kstat *stat) | 2925 | static inline int vfs_stat(const char __user *filename, struct kstat *stat) |
| 2927 | { | 2926 | { |
| 2928 | return vfs_statx(AT_FDCWD, filename, 0, stat, STATX_BASIC_STATS); | 2927 | return vfs_statx(AT_FDCWD, filename, AT_NO_AUTOMOUNT, |
| 2928 | stat, STATX_BASIC_STATS); | ||
| 2929 | } | 2929 | } |
| 2930 | static inline int vfs_lstat(const char __user *name, struct kstat *stat) | 2930 | static inline int vfs_lstat(const char __user *name, struct kstat *stat) |
| 2931 | { | 2931 | { |
| 2932 | return vfs_statx(AT_FDCWD, name, AT_SYMLINK_NOFOLLOW, | 2932 | return vfs_statx(AT_FDCWD, name, AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT, |
| 2933 | stat, STATX_BASIC_STATS); | 2933 | stat, STATX_BASIC_STATS); |
| 2934 | } | 2934 | } |
| 2935 | static inline int vfs_fstatat(int dfd, const char __user *filename, | 2935 | static inline int vfs_fstatat(int dfd, const char __user *filename, |
| 2936 | struct kstat *stat, int flags) | 2936 | struct kstat *stat, int flags) |
| 2937 | { | 2937 | { |
| 2938 | return vfs_statx(dfd, filename, flags, stat, STATX_BASIC_STATS); | 2938 | return vfs_statx(dfd, filename, flags | AT_NO_AUTOMOUNT, |
| 2939 | stat, STATX_BASIC_STATS); | ||
| 2939 | } | 2940 | } |
| 2940 | static inline int vfs_fstat(int fd, struct kstat *stat) | 2941 | static inline int vfs_fstat(int fd, struct kstat *stat) |
| 2941 | { | 2942 | { |
| @@ -3000,9 +3001,10 @@ extern const struct file_operations simple_dir_operations; · 58 unmodified lines | |||
| 3000 | extern const struct inode_operations simple_dir_inode_operations; | 3001 | extern const struct inode_operations simple_dir_inode_operations; |
| 3001 | extern void make_empty_dir_inode(struct inode *inode); | 3002 | extern void make_empty_dir_inode(struct inode *inode); |
| 3002 | extern bool is_empty_dir_inode(struct inode *inode); | 3003 | extern bool is_empty_dir_inode(struct inode *inode); |
| 3003 | struct tree_descr { char *name; const struct file_operations *ops; int mode; }; | 3004 | struct tree_descr { const char *name; const struct file_operations *ops; int mode; }; |
| 3004 | struct dentry *d_alloc_name(struct dentry *, const char *); | 3005 | struct dentry *d_alloc_name(struct dentry *, const char *); |
| 3005 | extern int simple_fill_super(struct super_block *, unsigned long, struct tree_descr *); | 3006 | extern int simple_fill_super(struct super_block *, unsigned long, |
| 3007 | const struct tree_descr *); | ||
| 3006 | extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count); | 3008 | extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count); |
| 3007 | extern void simple_release_fs(struct vfsmount **mount, int *count); | 3009 | extern void simple_release_fs(struct vfsmount **mount, int *count); |
| 3008 | 3010 | ||
| @@ -429,7 +429,7 @@ static int bpf_parse_options(char *data, struct bpf_mount_opts *opts) · 428 unmodified lines | |||
| 429 | 429 | ||
| 430 | static int bpf_fill_super(struct super_block *sb, void *data, int silent) | 430 | static int bpf_fill_super(struct super_block *sb, void *data, int silent) |
| 431 | { | 431 | { |
| 432 | static struct tree_descr bpf_rfiles[] = { { "" } }; | 432 | static const struct tree_descr bpf_rfiles[] = { { "" } }; |
| 433 | struct bpf_mount_opts opts; | 433 | struct bpf_mount_opts opts; |
| 434 | struct inode *inode; | 434 | struct inode *inode; |
| 435 | int ret; | 435 | int ret; |
| @@ -28,7 +28,7 @@ static int mount_count; · 27 unmodified lines | |||
| 28 | 28 | ||
| 29 | static int fill_super(struct super_block *sb, void *data, int silent) | 29 | static int fill_super(struct super_block *sb, void *data, int silent) |
| 30 | { | 30 | { |
| 31 | static struct tree_descr files[] = {{""}}; | 31 | static const struct tree_descr files[] = {{""}}; |
| 32 | 32 | ||
| 33 | return simple_fill_super(sb, SECURITYFS_MAGIC, files); | 33 | return simple_fill_super(sb, SECURITYFS_MAGIC, files); |
| 34 | } | 34 | } |
| @@ -1496,7 +1496,7 @@ static const struct file_operations sel_avc_cache_stats_ops = { · 1495 unmodified lines | |||
| 1496 | static int sel_make_avc_files(struct dentry *dir) | 1496 | static int sel_make_avc_files(struct dentry *dir) |
| 1497 | { | 1497 | { |
| 1498 | int i; | 1498 | int i; |
| 1499 | static struct tree_descr files[] = { | 1499 | static const struct tree_descr files[] = { |
| 1500 | { "cache_threshold", | 1500 | { "cache_threshold", |
| 1501 | &sel_avc_cache_threshold_ops, S_IRUGO|S_IWUSR }, | 1501 | &sel_avc_cache_threshold_ops, S_IRUGO|S_IWUSR }, |
| 1502 | { "hash_stats", &sel_avc_hash_stats_ops, S_IRUGO }, | 1502 | { "hash_stats", &sel_avc_hash_stats_ops, S_IRUGO }, |
| @@ -1805,7 +1805,7 @@ static int sel_fill_super(struct super_block *sb, void *data, int silent) · 302 unmodified lines | |||
| 1805 | struct inode *inode; | 1805 | struct inode *inode; |
| 1806 | struct inode_security_struct *isec; | 1806 | struct inode_security_struct *isec; |
| 1807 | 1807 | ||
| 1808 | static struct tree_descr selinux_files[] = { | 1808 | static const struct tree_descr selinux_files[] = { |
| 1809 | [SEL_LOAD] = {"load", &sel_load_ops, S_IRUSR|S_IWUSR}, | 1809 | [SEL_LOAD] = {"load", &sel_load_ops, S_IRUSR|S_IWUSR}, |
| 1810 | [SEL_ENFORCE] = {"enforce", &sel_enforce_ops, S_IRUGO|S_IWUSR}, | 1810 | [SEL_ENFORCE] = {"enforce", &sel_enforce_ops, S_IRUGO|S_IWUSR}, |
| 1811 | [SEL_CONTEXT] = {"context", &transaction_ops, S_IRUGO|S_IWUGO}, | 1811 | [SEL_CONTEXT] = {"context", &transaction_ops, S_IRUGO|S_IWUGO}, |
| @@ -2855,7 +2855,7 @@ static int smk_fill_super(struct super_block *sb, void *data, int silent) · 2854 unmodified lines | |||
| 2855 | int rc; | 2855 | int rc; |
| 2856 | struct inode *root_inode; | 2856 | struct inode *root_inode; |
| 2857 | 2857 | ||
| 2858 | static struct tree_descr smack_files[] = { | 2858 | static const struct tree_descr smack_files[] = { |
| 2859 | [SMK_LOAD] = { | 2859 | [SMK_LOAD] = { |
| 2860 | "load", &smk_load_ops, S_IRUGO|S_IWUSR}, | 2860 | "load", &smk_load_ops, S_IRUGO|S_IWUSR}, |
| 2861 | [SMK_CIPSO] = { | 2861 | [SMK_CIPSO] = { |