diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-17 09:04:38 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-17 09:04:38 -0400 |
| commit | 54e514b91b95d6441c12a7955addfb9f9d2afc65 (patch) | |
| tree | 8b73d901bd2a6ec5a31f34a8954e5ea92216dd6c /fs | |
| parent | 4fc8adcfec3da639da76e8314c9ccefe5bf9a045 (diff) | |
| parent | 6c8c90319c0bb1c9e0b68e721359b89ae4f28465 (diff) | |
Merge branch 'akpm' (patches from Andrew)
Merge third patchbomb from Andrew Morton:
- various misc things
- a couple of lib/ optimisations
- provide DIV_ROUND_CLOSEST_ULL()
- checkpatch updates
- rtc tree
- befs, nilfs2, hfs, hfsplus, fatfs, adfs, affs, bfs
- ptrace fixes
- fork() fixes
- seccomp cleanups
- more mmap_sem hold time reductions from Davidlohr
* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (138 commits)
proc: show locks in /proc/pid/fdinfo/X
docs: add missing and new /proc/PID/status file entries, fix typos
drivers/rtc/rtc-at91rm9200.c: make IO endian agnostic
Documentation/spi/spidev_test.c: fix warning
drivers/rtc/rtc-s5m.c: allow usage on device type different than main MFD type
.gitignore: ignore *.tar
MAINTAINERS: add Mediatek SoC mailing list
tomoyo: reduce mmap_sem hold for mm->exe_file
powerpc/oprofile: reduce mmap_sem hold for exe_file
oprofile: reduce mmap_sem hold for mm->exe_file
mips: ip32: add platform data hooks to use DS1685 driver
lib/Kconfig: fix up HAVE_ARCH_BITREVERSE help text
x86: switch to using asm-generic for seccomp.h
sparc: switch to using asm-generic for seccomp.h
powerpc: switch to using asm-generic for seccomp.h
parisc: switch to using asm-generic for seccomp.h
mips: switch to using asm-generic for seccomp.h
microblaze: use asm-generic for seccomp.h
arm: use asm-generic for seccomp.h
seccomp: allow COMPAT sigreturn overrides
...
Diffstat (limited to 'fs')
51 files changed, 561 insertions, 362 deletions
diff --git a/fs/adfs/dir_fplus.c b/fs/adfs/dir_fplus.c index f2ba88ab4aed..82d14cdf70f9 100644 --- a/fs/adfs/dir_fplus.c +++ b/fs/adfs/dir_fplus.c | |||
| @@ -61,6 +61,7 @@ adfs_fplus_read(struct super_block *sb, unsigned int id, unsigned int sz, struct | |||
| 61 | kcalloc(size, sizeof(struct buffer_head *), | 61 | kcalloc(size, sizeof(struct buffer_head *), |
| 62 | GFP_KERNEL); | 62 | GFP_KERNEL); |
| 63 | if (!bh_fplus) { | 63 | if (!bh_fplus) { |
| 64 | ret = -ENOMEM; | ||
| 64 | adfs_error(sb, "not enough memory for" | 65 | adfs_error(sb, "not enough memory for" |
| 65 | " dir object %X (%d blocks)", id, size); | 66 | " dir object %X (%d blocks)", id, size); |
| 66 | goto out; | 67 | goto out; |
diff --git a/fs/adfs/super.c b/fs/adfs/super.c index 9852bdf34d76..a19c31d3f369 100644 --- a/fs/adfs/super.c +++ b/fs/adfs/super.c | |||
| @@ -316,7 +316,7 @@ static struct adfs_discmap *adfs_read_map(struct super_block *sb, struct adfs_di | |||
| 316 | dm = kmalloc(nzones * sizeof(*dm), GFP_KERNEL); | 316 | dm = kmalloc(nzones * sizeof(*dm), GFP_KERNEL); |
| 317 | if (dm == NULL) { | 317 | if (dm == NULL) { |
| 318 | adfs_error(sb, "not enough memory"); | 318 | adfs_error(sb, "not enough memory"); |
| 319 | return NULL; | 319 | return ERR_PTR(-ENOMEM); |
| 320 | } | 320 | } |
| 321 | 321 | ||
| 322 | for (zone = 0; zone < nzones; zone++, map_addr++) { | 322 | for (zone = 0; zone < nzones; zone++, map_addr++) { |
| @@ -349,7 +349,7 @@ error_free: | |||
| 349 | brelse(dm[zone].dm_bh); | 349 | brelse(dm[zone].dm_bh); |
| 350 | 350 | ||
| 351 | kfree(dm); | 351 | kfree(dm); |
| 352 | return NULL; | 352 | return ERR_PTR(-EIO); |
| 353 | } | 353 | } |
| 354 | 354 | ||
| 355 | static inline unsigned long adfs_discsize(struct adfs_discrecord *dr, int block_bits) | 355 | static inline unsigned long adfs_discsize(struct adfs_discrecord *dr, int block_bits) |
| @@ -370,6 +370,7 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 370 | unsigned char *b_data; | 370 | unsigned char *b_data; |
| 371 | struct adfs_sb_info *asb; | 371 | struct adfs_sb_info *asb; |
| 372 | struct inode *root; | 372 | struct inode *root; |
| 373 | int ret = -EINVAL; | ||
| 373 | 374 | ||
| 374 | sb->s_flags |= MS_NODIRATIME; | 375 | sb->s_flags |= MS_NODIRATIME; |
| 375 | 376 | ||
| @@ -391,6 +392,7 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 391 | sb_set_blocksize(sb, BLOCK_SIZE); | 392 | sb_set_blocksize(sb, BLOCK_SIZE); |
| 392 | if (!(bh = sb_bread(sb, ADFS_DISCRECORD / BLOCK_SIZE))) { | 393 | if (!(bh = sb_bread(sb, ADFS_DISCRECORD / BLOCK_SIZE))) { |
| 393 | adfs_error(sb, "unable to read superblock"); | 394 | adfs_error(sb, "unable to read superblock"); |
| 395 | ret = -EIO; | ||
| 394 | goto error; | 396 | goto error; |
| 395 | } | 397 | } |
| 396 | 398 | ||
| @@ -400,6 +402,7 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 400 | if (!silent) | 402 | if (!silent) |
| 401 | printk("VFS: Can't find an adfs filesystem on dev " | 403 | printk("VFS: Can't find an adfs filesystem on dev " |
| 402 | "%s.\n", sb->s_id); | 404 | "%s.\n", sb->s_id); |
| 405 | ret = -EINVAL; | ||
| 403 | goto error_free_bh; | 406 | goto error_free_bh; |
| 404 | } | 407 | } |
| 405 | 408 | ||
| @@ -412,6 +415,7 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 412 | if (!silent) | 415 | if (!silent) |
| 413 | printk("VPS: Can't find an adfs filesystem on dev " | 416 | printk("VPS: Can't find an adfs filesystem on dev " |
| 414 | "%s.\n", sb->s_id); | 417 | "%s.\n", sb->s_id); |
| 418 | ret = -EINVAL; | ||
| 415 | goto error_free_bh; | 419 | goto error_free_bh; |
| 416 | } | 420 | } |
| 417 | 421 | ||
| @@ -421,11 +425,13 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 421 | if (!bh) { | 425 | if (!bh) { |
| 422 | adfs_error(sb, "couldn't read superblock on " | 426 | adfs_error(sb, "couldn't read superblock on " |
| 423 | "2nd try."); | 427 | "2nd try."); |
| 428 | ret = -EIO; | ||
| 424 | goto error; | 429 | goto error; |
| 425 | } | 430 | } |
| 426 | b_data = bh->b_data + (ADFS_DISCRECORD % sb->s_blocksize); | 431 | b_data = bh->b_data + (ADFS_DISCRECORD % sb->s_blocksize); |
| 427 | if (adfs_checkbblk(b_data)) { | 432 | if (adfs_checkbblk(b_data)) { |
| 428 | adfs_error(sb, "disc record mismatch, very weird!"); | 433 | adfs_error(sb, "disc record mismatch, very weird!"); |
| 434 | ret = -EINVAL; | ||
| 429 | goto error_free_bh; | 435 | goto error_free_bh; |
| 430 | } | 436 | } |
| 431 | dr = (struct adfs_discrecord *)(b_data + ADFS_DR_OFFSET); | 437 | dr = (struct adfs_discrecord *)(b_data + ADFS_DR_OFFSET); |
| @@ -433,6 +439,7 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 433 | if (!silent) | 439 | if (!silent) |
| 434 | printk(KERN_ERR "VFS: Unsupported blocksize on dev " | 440 | printk(KERN_ERR "VFS: Unsupported blocksize on dev " |
| 435 | "%s.\n", sb->s_id); | 441 | "%s.\n", sb->s_id); |
| 442 | ret = -EINVAL; | ||
| 436 | goto error; | 443 | goto error; |
| 437 | } | 444 | } |
| 438 | 445 | ||
| @@ -447,10 +454,12 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 447 | asb->s_size = adfs_discsize(dr, sb->s_blocksize_bits); | 454 | asb->s_size = adfs_discsize(dr, sb->s_blocksize_bits); |
| 448 | asb->s_version = dr->format_version; | 455 | asb->s_version = dr->format_version; |
| 449 | asb->s_log2sharesize = dr->log2sharesize; | 456 | asb->s_log2sharesize = dr->log2sharesize; |
| 450 | 457 | ||
| 451 | asb->s_map = adfs_read_map(sb, dr); | 458 | asb->s_map = adfs_read_map(sb, dr); |
| 452 | if (!asb->s_map) | 459 | if (IS_ERR(asb->s_map)) { |
| 460 | ret = PTR_ERR(asb->s_map); | ||
| 453 | goto error_free_bh; | 461 | goto error_free_bh; |
| 462 | } | ||
| 454 | 463 | ||
| 455 | brelse(bh); | 464 | brelse(bh); |
| 456 | 465 | ||
| @@ -499,6 +508,7 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 499 | brelse(asb->s_map[i].dm_bh); | 508 | brelse(asb->s_map[i].dm_bh); |
| 500 | kfree(asb->s_map); | 509 | kfree(asb->s_map); |
| 501 | adfs_error(sb, "get root inode failed\n"); | 510 | adfs_error(sb, "get root inode failed\n"); |
| 511 | ret = -EIO; | ||
| 502 | goto error; | 512 | goto error; |
| 503 | } | 513 | } |
| 504 | return 0; | 514 | return 0; |
| @@ -508,7 +518,7 @@ error_free_bh: | |||
| 508 | error: | 518 | error: |
| 509 | sb->s_fs_info = NULL; | 519 | sb->s_fs_info = NULL; |
| 510 | kfree(asb); | 520 | kfree(asb); |
| 511 | return -EINVAL; | 521 | return ret; |
| 512 | } | 522 | } |
| 513 | 523 | ||
| 514 | static struct dentry *adfs_mount(struct file_system_type *fs_type, | 524 | static struct dentry *adfs_mount(struct file_system_type *fs_type, |
diff --git a/fs/affs/affs.h b/fs/affs/affs.h index c8764bd7497d..cffe8370fb44 100644 --- a/fs/affs/affs.h +++ b/fs/affs/affs.h | |||
| @@ -106,18 +106,22 @@ struct affs_sb_info { | |||
| 106 | spinlock_t work_lock; /* protects sb_work and work_queued */ | 106 | spinlock_t work_lock; /* protects sb_work and work_queued */ |
| 107 | }; | 107 | }; |
| 108 | 108 | ||
| 109 | #define SF_INTL 0x0001 /* International filesystem. */ | 109 | #define AFFS_MOUNT_SF_INTL 0x0001 /* International filesystem. */ |
| 110 | #define SF_BM_VALID 0x0002 /* Bitmap is valid. */ | 110 | #define AFFS_MOUNT_SF_BM_VALID 0x0002 /* Bitmap is valid. */ |
| 111 | #define SF_IMMUTABLE 0x0004 /* Protection bits cannot be changed */ | 111 | #define AFFS_MOUNT_SF_IMMUTABLE 0x0004 /* Protection bits cannot be changed */ |
| 112 | #define SF_QUIET 0x0008 /* chmod errors will be not reported */ | 112 | #define AFFS_MOUNT_SF_QUIET 0x0008 /* chmod errors will be not reported */ |
| 113 | #define SF_SETUID 0x0010 /* Ignore Amiga uid */ | 113 | #define AFFS_MOUNT_SF_SETUID 0x0010 /* Ignore Amiga uid */ |
| 114 | #define SF_SETGID 0x0020 /* Ignore Amiga gid */ | 114 | #define AFFS_MOUNT_SF_SETGID 0x0020 /* Ignore Amiga gid */ |
| 115 | #define SF_SETMODE 0x0040 /* Ignore Amiga protection bits */ | 115 | #define AFFS_MOUNT_SF_SETMODE 0x0040 /* Ignore Amiga protection bits */ |
| 116 | #define SF_MUFS 0x0100 /* Use MUFS uid/gid mapping */ | 116 | #define AFFS_MOUNT_SF_MUFS 0x0100 /* Use MUFS uid/gid mapping */ |
| 117 | #define SF_OFS 0x0200 /* Old filesystem */ | 117 | #define AFFS_MOUNT_SF_OFS 0x0200 /* Old filesystem */ |
| 118 | #define SF_PREFIX 0x0400 /* Buffer for prefix is allocated */ | 118 | #define AFFS_MOUNT_SF_PREFIX 0x0400 /* Buffer for prefix is allocated */ |
| 119 | #define SF_VERBOSE 0x0800 /* Talk about fs when mounting */ | 119 | #define AFFS_MOUNT_SF_VERBOSE 0x0800 /* Talk about fs when mounting */ |
| 120 | #define SF_NO_TRUNCATE 0x1000 /* Don't truncate filenames */ | 120 | #define AFFS_MOUNT_SF_NO_TRUNCATE 0x1000 /* Don't truncate filenames */ |
| 121 | |||
| 122 | #define affs_clear_opt(o, opt) (o &= ~AFFS_MOUNT_##opt) | ||
| 123 | #define affs_set_opt(o, opt) (o |= AFFS_MOUNT_##opt) | ||
| 124 | #define affs_test_opt(o, opt) ((o) & AFFS_MOUNT_##opt) | ||
| 121 | 125 | ||
| 122 | /* short cut to get to the affs specific sb data */ | 126 | /* short cut to get to the affs specific sb data */ |
| 123 | static inline struct affs_sb_info *AFFS_SB(struct super_block *sb) | 127 | static inline struct affs_sb_info *AFFS_SB(struct super_block *sb) |
diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c index 388da1ea815d..5022ac96aa40 100644 --- a/fs/affs/amigaffs.c +++ b/fs/affs/amigaffs.c | |||
| @@ -472,7 +472,8 @@ bool | |||
| 472 | affs_nofilenametruncate(const struct dentry *dentry) | 472 | affs_nofilenametruncate(const struct dentry *dentry) |
| 473 | { | 473 | { |
| 474 | struct inode *inode = dentry->d_inode; | 474 | struct inode *inode = dentry->d_inode; |
| 475 | return AFFS_SB(inode->i_sb)->s_flags & SF_NO_TRUNCATE; | 475 | |
| 476 | return affs_test_opt(AFFS_SB(inode->i_sb)->s_flags, SF_NO_TRUNCATE); | ||
| 476 | 477 | ||
| 477 | } | 478 | } |
| 478 | 479 | ||
diff --git a/fs/affs/file.c b/fs/affs/file.c index dcf27951781c..659c579c4588 100644 --- a/fs/affs/file.c +++ b/fs/affs/file.c | |||
| @@ -914,7 +914,7 @@ affs_truncate(struct inode *inode) | |||
| 914 | if (inode->i_size) { | 914 | if (inode->i_size) { |
| 915 | AFFS_I(inode)->i_blkcnt = last_blk + 1; | 915 | AFFS_I(inode)->i_blkcnt = last_blk + 1; |
| 916 | AFFS_I(inode)->i_extcnt = ext + 1; | 916 | AFFS_I(inode)->i_extcnt = ext + 1; |
| 917 | if (AFFS_SB(sb)->s_flags & SF_OFS) { | 917 | if (affs_test_opt(AFFS_SB(sb)->s_flags, SF_OFS)) { |
| 918 | struct buffer_head *bh = affs_bread_ino(inode, last_blk, 0); | 918 | struct buffer_head *bh = affs_bread_ino(inode, last_blk, 0); |
| 919 | u32 tmp; | 919 | u32 tmp; |
| 920 | if (IS_ERR(bh)) { | 920 | if (IS_ERR(bh)) { |
diff --git a/fs/affs/inode.c b/fs/affs/inode.c index 6f34510449e8..9628003ccd2f 100644 --- a/fs/affs/inode.c +++ b/fs/affs/inode.c | |||
| @@ -66,23 +66,23 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino) | |||
| 66 | AFFS_I(inode)->i_lastalloc = 0; | 66 | AFFS_I(inode)->i_lastalloc = 0; |
| 67 | AFFS_I(inode)->i_pa_cnt = 0; | 67 | AFFS_I(inode)->i_pa_cnt = 0; |
| 68 | 68 | ||
| 69 | if (sbi->s_flags & SF_SETMODE) | 69 | if (affs_test_opt(sbi->s_flags, SF_SETMODE)) |
| 70 | inode->i_mode = sbi->s_mode; | 70 | inode->i_mode = sbi->s_mode; |
| 71 | else | 71 | else |
| 72 | inode->i_mode = prot_to_mode(prot); | 72 | inode->i_mode = prot_to_mode(prot); |
| 73 | 73 | ||
| 74 | id = be16_to_cpu(tail->uid); | 74 | id = be16_to_cpu(tail->uid); |
| 75 | if (id == 0 || sbi->s_flags & SF_SETUID) | 75 | if (id == 0 || affs_test_opt(sbi->s_flags, SF_SETUID)) |
| 76 | inode->i_uid = sbi->s_uid; | 76 | inode->i_uid = sbi->s_uid; |
| 77 | else if (id == 0xFFFF && sbi->s_flags & SF_MUFS) | 77 | else if (id == 0xFFFF && affs_test_opt(sbi->s_flags, SF_MUFS)) |
| 78 | i_uid_write(inode, 0); | 78 | i_uid_write(inode, 0); |
| 79 | else | 79 | else |
| 80 | i_uid_write(inode, id); | 80 | i_uid_write(inode, id); |
| 81 | 81 | ||
| 82 | id = be16_to_cpu(tail->gid); | 82 | id = be16_to_cpu(tail->gid); |
| 83 | if (id == 0 || sbi->s_flags & SF_SETGID) | 83 | if (id == 0 || affs_test_opt(sbi->s_flags, SF_SETGID)) |
| 84 | inode->i_gid = sbi->s_gid; | 84 | inode->i_gid = sbi->s_gid; |
| 85 | else if (id == 0xFFFF && sbi->s_flags & SF_MUFS) | 85 | else if (id == 0xFFFF && affs_test_opt(sbi->s_flags, SF_MUFS)) |
| 86 | i_gid_write(inode, 0); | 86 | i_gid_write(inode, 0); |
| 87 | else | 87 | else |
| 88 | i_gid_write(inode, id); | 88 | i_gid_write(inode, id); |
| @@ -94,7 +94,7 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino) | |||
| 94 | /* fall through */ | 94 | /* fall through */ |
| 95 | case ST_USERDIR: | 95 | case ST_USERDIR: |
| 96 | if (be32_to_cpu(tail->stype) == ST_USERDIR || | 96 | if (be32_to_cpu(tail->stype) == ST_USERDIR || |
| 97 | sbi->s_flags & SF_SETMODE) { | 97 | affs_test_opt(sbi->s_flags, SF_SETMODE)) { |
| 98 | if (inode->i_mode & S_IRUSR) | 98 | if (inode->i_mode & S_IRUSR) |
| 99 | inode->i_mode |= S_IXUSR; | 99 | inode->i_mode |= S_IXUSR; |
| 100 | if (inode->i_mode & S_IRGRP) | 100 | if (inode->i_mode & S_IRGRP) |
| @@ -133,7 +133,8 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino) | |||
| 133 | } | 133 | } |
| 134 | if (tail->link_chain) | 134 | if (tail->link_chain) |
| 135 | set_nlink(inode, 2); | 135 | set_nlink(inode, 2); |
| 136 | inode->i_mapping->a_ops = (sbi->s_flags & SF_OFS) ? &affs_aops_ofs : &affs_aops; | 136 | inode->i_mapping->a_ops = affs_test_opt(sbi->s_flags, SF_OFS) ? |
| 137 | &affs_aops_ofs : &affs_aops; | ||
| 137 | inode->i_op = &affs_file_inode_operations; | 138 | inode->i_op = &affs_file_inode_operations; |
| 138 | inode->i_fop = &affs_file_operations; | 139 | inode->i_fop = &affs_file_operations; |
| 139 | break; | 140 | break; |
| @@ -190,15 +191,15 @@ affs_write_inode(struct inode *inode, struct writeback_control *wbc) | |||
| 190 | if (!(inode->i_ino == AFFS_SB(sb)->s_root_block)) { | 191 | if (!(inode->i_ino == AFFS_SB(sb)->s_root_block)) { |
| 191 | uid = i_uid_read(inode); | 192 | uid = i_uid_read(inode); |
| 192 | gid = i_gid_read(inode); | 193 | gid = i_gid_read(inode); |
| 193 | if (AFFS_SB(sb)->s_flags & SF_MUFS) { | 194 | if (affs_test_opt(AFFS_SB(sb)->s_flags, SF_MUFS)) { |
| 194 | if (uid == 0 || uid == 0xFFFF) | 195 | if (uid == 0 || uid == 0xFFFF) |
| 195 | uid = uid ^ ~0; | 196 | uid = uid ^ ~0; |
| 196 | if (gid == 0 || gid == 0xFFFF) | 197 | if (gid == 0 || gid == 0xFFFF) |
| 197 | gid = gid ^ ~0; | 198 | gid = gid ^ ~0; |
| 198 | } | 199 | } |
| 199 | if (!(AFFS_SB(sb)->s_flags & SF_SETUID)) | 200 | if (!affs_test_opt(AFFS_SB(sb)->s_flags, SF_SETUID)) |
| 200 | tail->uid = cpu_to_be16(uid); | 201 | tail->uid = cpu_to_be16(uid); |
| 201 | if (!(AFFS_SB(sb)->s_flags & SF_SETGID)) | 202 | if (!affs_test_opt(AFFS_SB(sb)->s_flags, SF_SETGID)) |
| 202 | tail->gid = cpu_to_be16(gid); | 203 | tail->gid = cpu_to_be16(gid); |
| 203 | } | 204 | } |
| 204 | } | 205 | } |
| @@ -221,11 +222,14 @@ affs_notify_change(struct dentry *dentry, struct iattr *attr) | |||
| 221 | if (error) | 222 | if (error) |
| 222 | goto out; | 223 | goto out; |
| 223 | 224 | ||
| 224 | if (((attr->ia_valid & ATTR_UID) && (AFFS_SB(inode->i_sb)->s_flags & SF_SETUID)) || | 225 | if (((attr->ia_valid & ATTR_UID) && |
| 225 | ((attr->ia_valid & ATTR_GID) && (AFFS_SB(inode->i_sb)->s_flags & SF_SETGID)) || | 226 | affs_test_opt(AFFS_SB(inode->i_sb)->s_flags, SF_SETUID)) || |
| 227 | ((attr->ia_valid & ATTR_GID) && | ||
| 228 | affs_test_opt(AFFS_SB(inode->i_sb)->s_flags, SF_SETGID)) || | ||
| 226 | ((attr->ia_valid & ATTR_MODE) && | 229 | ((attr->ia_valid & ATTR_MODE) && |
| 227 | (AFFS_SB(inode->i_sb)->s_flags & (SF_SETMODE | SF_IMMUTABLE)))) { | 230 | (AFFS_SB(inode->i_sb)->s_flags & |
| 228 | if (!(AFFS_SB(inode->i_sb)->s_flags & SF_QUIET)) | 231 | (AFFS_MOUNT_SF_SETMODE | AFFS_MOUNT_SF_IMMUTABLE)))) { |
| 232 | if (!affs_test_opt(AFFS_SB(inode->i_sb)->s_flags, SF_QUIET)) | ||
| 229 | error = -EPERM; | 233 | error = -EPERM; |
| 230 | goto out; | 234 | goto out; |
| 231 | } | 235 | } |
diff --git a/fs/affs/namei.c b/fs/affs/namei.c index ffb7bd82c2a5..ec8ca0efb960 100644 --- a/fs/affs/namei.c +++ b/fs/affs/namei.c | |||
| @@ -53,7 +53,8 @@ affs_intl_toupper(int ch) | |||
| 53 | static inline toupper_t | 53 | static inline toupper_t |
| 54 | affs_get_toupper(struct super_block *sb) | 54 | affs_get_toupper(struct super_block *sb) |
| 55 | { | 55 | { |
| 56 | return AFFS_SB(sb)->s_flags & SF_INTL ? affs_intl_toupper : affs_toupper; | 56 | return affs_test_opt(AFFS_SB(sb)->s_flags, SF_INTL) ? |
| 57 | affs_intl_toupper : affs_toupper; | ||
| 57 | } | 58 | } |
| 58 | 59 | ||
| 59 | /* | 60 | /* |
| @@ -275,7 +276,8 @@ affs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool excl) | |||
| 275 | 276 | ||
| 276 | inode->i_op = &affs_file_inode_operations; | 277 | inode->i_op = &affs_file_inode_operations; |
| 277 | inode->i_fop = &affs_file_operations; | 278 | inode->i_fop = &affs_file_operations; |
| 278 | inode->i_mapping->a_ops = (AFFS_SB(sb)->s_flags & SF_OFS) ? &affs_aops_ofs : &affs_aops; | 279 | inode->i_mapping->a_ops = affs_test_opt(AFFS_SB(sb)->s_flags, SF_OFS) ? |
| 280 | &affs_aops_ofs : &affs_aops; | ||
| 279 | error = affs_add_entry(dir, inode, dentry, ST_FILE); | 281 | error = affs_add_entry(dir, inode, dentry, ST_FILE); |
| 280 | if (error) { | 282 | if (error) { |
| 281 | clear_nlink(inode); | 283 | clear_nlink(inode); |
diff --git a/fs/affs/super.c b/fs/affs/super.c index 4cf0e9113fb6..3f89c9e05b40 100644 --- a/fs/affs/super.c +++ b/fs/affs/super.c | |||
| @@ -227,22 +227,22 @@ parse_options(char *options, kuid_t *uid, kgid_t *gid, int *mode, int *reserved, | |||
| 227 | if (match_octal(&args[0], &option)) | 227 | if (match_octal(&args[0], &option)) |
| 228 | return 0; | 228 | return 0; |
| 229 | *mode = option & 0777; | 229 | *mode = option & 0777; |
| 230 | *mount_opts |= SF_SETMODE; | 230 | affs_set_opt(*mount_opts, SF_SETMODE); |
| 231 | break; | 231 | break; |
| 232 | case Opt_mufs: | 232 | case Opt_mufs: |
| 233 | *mount_opts |= SF_MUFS; | 233 | affs_set_opt(*mount_opts, SF_MUFS); |
| 234 | break; | 234 | break; |
| 235 | case Opt_notruncate: | 235 | case Opt_notruncate: |
| 236 | *mount_opts |= SF_NO_TRUNCATE; | 236 | affs_set_opt(*mount_opts, SF_NO_TRUNCATE); |
| 237 | break; | 237 | break; |
| 238 | case Opt_prefix: | 238 | case Opt_prefix: |
| 239 | *prefix = match_strdup(&args[0]); | 239 | *prefix = match_strdup(&args[0]); |
| 240 | if (!*prefix) | 240 | if (!*prefix) |
| 241 | return 0; | 241 | return 0; |
| 242 | *mount_opts |= SF_PREFIX; | 242 | affs_set_opt(*mount_opts, SF_PREFIX); |
| 243 | break; | 243 | break; |
| 244 | case Opt_protect: | 244 | case Opt_protect: |
| 245 | *mount_opts |= SF_IMMUTABLE; | 245 | affs_set_opt(*mount_opts, SF_IMMUTABLE); |
| 246 | break; | 246 | break; |
| 247 | case Opt_reserved: | 247 | case Opt_reserved: |
| 248 | if (match_int(&args[0], reserved)) | 248 | if (match_int(&args[0], reserved)) |
| @@ -258,7 +258,7 @@ parse_options(char *options, kuid_t *uid, kgid_t *gid, int *mode, int *reserved, | |||
| 258 | *gid = make_kgid(current_user_ns(), option); | 258 | *gid = make_kgid(current_user_ns(), option); |
| 259 | if (!gid_valid(*gid)) | 259 | if (!gid_valid(*gid)) |
| 260 | return 0; | 260 | return 0; |
| 261 | *mount_opts |= SF_SETGID; | 261 | affs_set_opt(*mount_opts, SF_SETGID); |
| 262 | break; | 262 | break; |
| 263 | case Opt_setuid: | 263 | case Opt_setuid: |
| 264 | if (match_int(&args[0], &option)) | 264 | if (match_int(&args[0], &option)) |
| @@ -266,10 +266,10 @@ parse_options(char *options, kuid_t *uid, kgid_t *gid, int *mode, int *reserved, | |||
| 266 | *uid = make_kuid(current_user_ns(), option); | 266 | *uid = make_kuid(current_user_ns(), option); |
| 267 | if (!uid_valid(*uid)) | 267 | if (!uid_valid(*uid)) |
| 268 | return 0; | 268 | return 0; |
| 269 | *mount_opts |= SF_SETUID; | 269 | affs_set_opt(*mount_opts, SF_SETUID); |
| 270 | break; | 270 | break; |
| 271 | case Opt_verbose: | 271 | case Opt_verbose: |
| 272 | *mount_opts |= SF_VERBOSE; | 272 | affs_set_opt(*mount_opts, SF_VERBOSE); |
| 273 | break; | 273 | break; |
| 274 | case Opt_volume: { | 274 | case Opt_volume: { |
| 275 | char *vol = match_strdup(&args[0]); | 275 | char *vol = match_strdup(&args[0]); |
| @@ -435,30 +435,31 @@ got_root: | |||
| 435 | case MUFS_FS: | 435 | case MUFS_FS: |
| 436 | case MUFS_INTLFFS: | 436 | case MUFS_INTLFFS: |
| 437 | case MUFS_DCFFS: | 437 | case MUFS_DCFFS: |
| 438 | sbi->s_flags |= SF_MUFS; | 438 | affs_set_opt(sbi->s_flags, SF_MUFS); |
| 439 | /* fall thru */ | 439 | /* fall thru */ |
| 440 | case FS_INTLFFS: | 440 | case FS_INTLFFS: |
| 441 | case FS_DCFFS: | 441 | case FS_DCFFS: |
| 442 | sbi->s_flags |= SF_INTL; | 442 | affs_set_opt(sbi->s_flags, SF_INTL); |
| 443 | break; | 443 | break; |
| 444 | case MUFS_FFS: | 444 | case MUFS_FFS: |
| 445 | sbi->s_flags |= SF_MUFS; | 445 | affs_set_opt(sbi->s_flags, SF_MUFS); |
| 446 | break; | 446 | break; |
| 447 | case FS_FFS: | 447 | case FS_FFS: |
| 448 | break; | 448 | break; |
| 449 | case MUFS_OFS: | 449 | case MUFS_OFS: |
| 450 | sbi->s_flags |= SF_MUFS; | 450 | affs_set_opt(sbi->s_flags, SF_MUFS); |
| 451 | /* fall thru */ | 451 | /* fall thru */ |
| 452 | case FS_OFS: | 452 | case FS_OFS: |
| 453 | sbi->s_flags |= SF_OFS; | 453 | affs_set_opt(sbi->s_flags, SF_OFS); |
| 454 | sb->s_flags |= MS_NOEXEC; | 454 | sb->s_flags |= MS_NOEXEC; |
| 455 | break; | 455 | break; |
| 456 | case MUFS_DCOFS: | 456 | case MUFS_DCOFS: |
| 457 | case MUFS_INTLOFS: | 457 | case MUFS_INTLOFS: |
| 458 | sbi->s_flags |= SF_MUFS; | 458 | affs_set_opt(sbi->s_flags, SF_MUFS); |
| 459 | case FS_DCOFS: | 459 | case FS_DCOFS: |
| 460 | case FS_INTLOFS: | 460 | case FS_INTLOFS: |
| 461 | sbi->s_flags |= SF_INTL | SF_OFS; | 461 | affs_set_opt(sbi->s_flags, SF_INTL); |
| 462 | affs_set_opt(sbi->s_flags, SF_OFS); | ||
| 462 | sb->s_flags |= MS_NOEXEC; | 463 | sb->s_flags |= MS_NOEXEC; |
| 463 | break; | 464 | break; |
| 464 | default: | 465 | default: |
| @@ -467,7 +468,7 @@ got_root: | |||
| 467 | return -EINVAL; | 468 | return -EINVAL; |
| 468 | } | 469 | } |
| 469 | 470 | ||
| 470 | if (mount_flags & SF_VERBOSE) { | 471 | if (affs_test_opt(mount_flags, SF_VERBOSE)) { |
| 471 | u8 len = AFFS_ROOT_TAIL(sb, root_bh)->disk_name[0]; | 472 | u8 len = AFFS_ROOT_TAIL(sb, root_bh)->disk_name[0]; |
| 472 | pr_notice("Mounting volume \"%.*s\": Type=%.3s\\%c, Blocksize=%d\n", | 473 | pr_notice("Mounting volume \"%.*s\": Type=%.3s\\%c, Blocksize=%d\n", |
| 473 | len > 31 ? 31 : len, | 474 | len > 31 ? 31 : len, |
| @@ -478,7 +479,7 @@ got_root: | |||
| 478 | sb->s_flags |= MS_NODEV | MS_NOSUID; | 479 | sb->s_flags |= MS_NODEV | MS_NOSUID; |
| 479 | 480 | ||
| 480 | sbi->s_data_blksize = sb->s_blocksize; | 481 | sbi->s_data_blksize = sb->s_blocksize; |
| 481 | if (sbi->s_flags & SF_OFS) | 482 | if (affs_test_opt(sbi->s_flags, SF_OFS)) |
| 482 | sbi->s_data_blksize -= 24; | 483 | sbi->s_data_blksize -= 24; |
| 483 | 484 | ||
| 484 | tmp_flags = sb->s_flags; | 485 | tmp_flags = sb->s_flags; |
| @@ -493,7 +494,7 @@ got_root: | |||
| 493 | if (IS_ERR(root_inode)) | 494 | if (IS_ERR(root_inode)) |
| 494 | return PTR_ERR(root_inode); | 495 | return PTR_ERR(root_inode); |
| 495 | 496 | ||
| 496 | if (AFFS_SB(sb)->s_flags & SF_INTL) | 497 | if (affs_test_opt(AFFS_SB(sb)->s_flags, SF_INTL)) |
| 497 | sb->s_d_op = &affs_intl_dentry_operations; | 498 | sb->s_d_op = &affs_intl_dentry_operations; |
| 498 | else | 499 | else |
| 499 | sb->s_d_op = &affs_dentry_operations; | 500 | sb->s_d_op = &affs_dentry_operations; |
| @@ -520,10 +521,14 @@ affs_remount(struct super_block *sb, int *flags, char *data) | |||
| 520 | int root_block; | 521 | int root_block; |
| 521 | unsigned long mount_flags; | 522 | unsigned long mount_flags; |
| 522 | int res = 0; | 523 | int res = 0; |
| 523 | char *new_opts = kstrdup(data, GFP_KERNEL); | 524 | char *new_opts; |
| 524 | char volume[32]; | 525 | char volume[32]; |
| 525 | char *prefix = NULL; | 526 | char *prefix = NULL; |
| 526 | 527 | ||
| 528 | new_opts = kstrdup(data, GFP_KERNEL); | ||
| 529 | if (!new_opts) | ||
| 530 | return -ENOMEM; | ||
| 531 | |||
| 527 | pr_debug("%s(flags=0x%x,opts=\"%s\")\n", __func__, *flags, data); | 532 | pr_debug("%s(flags=0x%x,opts=\"%s\")\n", __func__, *flags, data); |
| 528 | 533 | ||
| 529 | sync_filesystem(sb); | 534 | sync_filesystem(sb); |
diff --git a/fs/befs/befs.h b/fs/befs/befs.h index 3a7813ab8c95..1fead8d56a98 100644 --- a/fs/befs/befs.h +++ b/fs/befs/befs.h | |||
| @@ -19,16 +19,16 @@ typedef u64 befs_blocknr_t; | |||
| 19 | * BeFS in memory structures | 19 | * BeFS in memory structures |
| 20 | */ | 20 | */ |
| 21 | 21 | ||
| 22 | typedef struct befs_mount_options { | 22 | struct befs_mount_options { |
| 23 | kgid_t gid; | 23 | kgid_t gid; |
| 24 | kuid_t uid; | 24 | kuid_t uid; |
| 25 | int use_gid; | 25 | int use_gid; |
| 26 | int use_uid; | 26 | int use_uid; |
| 27 | int debug; | 27 | int debug; |
| 28 | char *iocharset; | 28 | char *iocharset; |
| 29 | } befs_mount_options; | 29 | }; |
| 30 | 30 | ||
| 31 | typedef struct befs_sb_info { | 31 | struct befs_sb_info { |
| 32 | u32 magic1; | 32 | u32 magic1; |
| 33 | u32 block_size; | 33 | u32 block_size; |
| 34 | u32 block_shift; | 34 | u32 block_shift; |
| @@ -52,12 +52,11 @@ typedef struct befs_sb_info { | |||
| 52 | befs_inode_addr indices; | 52 | befs_inode_addr indices; |
| 53 | u32 magic3; | 53 | u32 magic3; |
| 54 | 54 | ||
| 55 | befs_mount_options mount_opts; | 55 | struct befs_mount_options mount_opts; |
| 56 | struct nls_table *nls; | 56 | struct nls_table *nls; |
| 57 | }; | ||
| 57 | 58 | ||
| 58 | } befs_sb_info; | 59 | struct befs_inode_info { |
| 59 | |||
| 60 | typedef struct befs_inode_info { | ||
| 61 | u32 i_flags; | 60 | u32 i_flags; |
| 62 | u32 i_type; | 61 | u32 i_type; |
| 63 | 62 | ||
| @@ -71,8 +70,7 @@ typedef struct befs_inode_info { | |||
| 71 | } i_data; | 70 | } i_data; |
| 72 | 71 | ||
| 73 | struct inode vfs_inode; | 72 | struct inode vfs_inode; |
| 74 | 73 | }; | |
| 75 | } befs_inode_info; | ||
| 76 | 74 | ||
| 77 | enum befs_err { | 75 | enum befs_err { |
| 78 | BEFS_OK, | 76 | BEFS_OK, |
| @@ -105,13 +103,13 @@ void befs_dump_index_node(const struct super_block *sb, befs_btree_nodehead *); | |||
| 105 | /* Gets a pointer to the private portion of the super_block | 103 | /* Gets a pointer to the private portion of the super_block |
| 106 | * structure from the public part | 104 | * structure from the public part |
| 107 | */ | 105 | */ |
| 108 | static inline befs_sb_info * | 106 | static inline struct befs_sb_info * |
| 109 | BEFS_SB(const struct super_block *super) | 107 | BEFS_SB(const struct super_block *super) |
| 110 | { | 108 | { |
| 111 | return (befs_sb_info *) super->s_fs_info; | 109 | return (struct befs_sb_info *) super->s_fs_info; |
| 112 | } | 110 | } |
| 113 | 111 | ||
| 114 | static inline befs_inode_info * | 112 | static inline struct befs_inode_info * |
| 115 | BEFS_I(const struct inode *inode) | 113 | BEFS_I(const struct inode *inode) |
| 116 | { | 114 | { |
| 117 | return list_entry(inode, struct befs_inode_info, vfs_inode); | 115 | return list_entry(inode, struct befs_inode_info, vfs_inode); |
diff --git a/fs/befs/datastream.c b/fs/befs/datastream.c index 1e8e0b8d8836..ebd50718659f 100644 --- a/fs/befs/datastream.c +++ b/fs/befs/datastream.c | |||
| @@ -168,7 +168,7 @@ befs_count_blocks(struct super_block * sb, befs_data_stream * ds) | |||
| 168 | befs_blocknr_t blocks; | 168 | befs_blocknr_t blocks; |
| 169 | befs_blocknr_t datablocks; /* File data blocks */ | 169 | befs_blocknr_t datablocks; /* File data blocks */ |
| 170 | befs_blocknr_t metablocks; /* FS metadata blocks */ | 170 | befs_blocknr_t metablocks; /* FS metadata blocks */ |
| 171 | befs_sb_info *befs_sb = BEFS_SB(sb); | 171 | struct befs_sb_info *befs_sb = BEFS_SB(sb); |
| 172 | 172 | ||
| 173 | befs_debug(sb, "---> %s", __func__); | 173 | befs_debug(sb, "---> %s", __func__); |
| 174 | 174 | ||
| @@ -428,7 +428,7 @@ befs_find_brun_dblindirect(struct super_block *sb, | |||
| 428 | struct buffer_head *indir_block; | 428 | struct buffer_head *indir_block; |
| 429 | befs_block_run indir_run; | 429 | befs_block_run indir_run; |
| 430 | befs_disk_inode_addr *iaddr_array = NULL; | 430 | befs_disk_inode_addr *iaddr_array = NULL; |
| 431 | befs_sb_info *befs_sb = BEFS_SB(sb); | 431 | struct befs_sb_info *befs_sb = BEFS_SB(sb); |
| 432 | 432 | ||
| 433 | befs_blocknr_t indir_start_blk = | 433 | befs_blocknr_t indir_start_blk = |
| 434 | data->max_indirect_range >> befs_sb->block_shift; | 434 | data->max_indirect_range >> befs_sb->block_shift; |
diff --git a/fs/befs/io.c b/fs/befs/io.c index 0408a3d601d0..7a5b4ec21c56 100644 --- a/fs/befs/io.c +++ b/fs/befs/io.c | |||
| @@ -28,7 +28,7 @@ befs_bread_iaddr(struct super_block *sb, befs_inode_addr iaddr) | |||
| 28 | { | 28 | { |
| 29 | struct buffer_head *bh = NULL; | 29 | struct buffer_head *bh = NULL; |
| 30 | befs_blocknr_t block = 0; | 30 | befs_blocknr_t block = 0; |
| 31 | befs_sb_info *befs_sb = BEFS_SB(sb); | 31 | struct befs_sb_info *befs_sb = BEFS_SB(sb); |
| 32 | 32 | ||
| 33 | befs_debug(sb, "---> Enter %s " | 33 | befs_debug(sb, "---> Enter %s " |
| 34 | "[%u, %hu, %hu]", __func__, iaddr.allocation_group, | 34 | "[%u, %hu, %hu]", __func__, iaddr.allocation_group, |
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index e089f1985fca..16e0a48bfccd 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c | |||
| @@ -51,7 +51,7 @@ static int befs_nls2utf(struct super_block *sb, const char *in, int in_len, | |||
| 51 | static void befs_put_super(struct super_block *); | 51 | static void befs_put_super(struct super_block *); |
| 52 | static int befs_remount(struct super_block *, int *, char *); | 52 | static int befs_remount(struct super_block *, int *, char *); |
| 53 | static int befs_statfs(struct dentry *, struct kstatfs *); | 53 | static int befs_statfs(struct dentry *, struct kstatfs *); |
| 54 | static int parse_options(char *, befs_mount_options *); | 54 | static int parse_options(char *, struct befs_mount_options *); |
| 55 | 55 | ||
| 56 | static const struct super_operations befs_sops = { | 56 | static const struct super_operations befs_sops = { |
| 57 | .alloc_inode = befs_alloc_inode, /* allocate a new inode */ | 57 | .alloc_inode = befs_alloc_inode, /* allocate a new inode */ |
| @@ -304,9 +304,8 @@ static struct inode *befs_iget(struct super_block *sb, unsigned long ino) | |||
| 304 | { | 304 | { |
| 305 | struct buffer_head *bh = NULL; | 305 | struct buffer_head *bh = NULL; |
| 306 | befs_inode *raw_inode = NULL; | 306 | befs_inode *raw_inode = NULL; |
| 307 | 307 | struct befs_sb_info *befs_sb = BEFS_SB(sb); | |
| 308 | befs_sb_info *befs_sb = BEFS_SB(sb); | 308 | struct befs_inode_info *befs_ino = NULL; |
| 309 | befs_inode_info *befs_ino = NULL; | ||
| 310 | struct inode *inode; | 309 | struct inode *inode; |
| 311 | long ret = -EIO; | 310 | long ret = -EIO; |
| 312 | 311 | ||
| @@ -472,7 +471,7 @@ static void * | |||
| 472 | befs_follow_link(struct dentry *dentry, struct nameidata *nd) | 471 | befs_follow_link(struct dentry *dentry, struct nameidata *nd) |
| 473 | { | 472 | { |
| 474 | struct super_block *sb = dentry->d_sb; | 473 | struct super_block *sb = dentry->d_sb; |
| 475 | befs_inode_info *befs_ino = BEFS_I(dentry->d_inode); | 474 | struct befs_inode_info *befs_ino = BEFS_I(dentry->d_inode); |
| 476 | befs_data_stream *data = &befs_ino->i_data.ds; | 475 | befs_data_stream *data = &befs_ino->i_data.ds; |
| 477 | befs_off_t len = data->size; | 476 | befs_off_t len = data->size; |
| 478 | char *link; | 477 | char *link; |
| @@ -502,7 +501,8 @@ befs_follow_link(struct dentry *dentry, struct nameidata *nd) | |||
| 502 | static void * | 501 | static void * |
| 503 | befs_fast_follow_link(struct dentry *dentry, struct nameidata *nd) | 502 | befs_fast_follow_link(struct dentry *dentry, struct nameidata *nd) |
| 504 | { | 503 | { |
| 505 | befs_inode_info *befs_ino = BEFS_I(dentry->d_inode); | 504 | struct befs_inode_info *befs_ino = BEFS_I(dentry->d_inode); |
| 505 | |||
| 506 | nd_set_link(nd, befs_ino->i_data.symlink); | 506 | nd_set_link(nd, befs_ino->i_data.symlink); |
| 507 | return NULL; | 507 | return NULL; |
| 508 | } | 508 | } |
| @@ -669,7 +669,7 @@ static const match_table_t befs_tokens = { | |||
| 669 | }; | 669 | }; |
| 670 | 670 | ||
| 671 | static int | 671 | static int |
| 672 | parse_options(char *options, befs_mount_options * opts) | 672 | parse_options(char *options, struct befs_mount_options *opts) |
| 673 | { | 673 | { |
| 674 | char *p; | 674 | char *p; |
| 675 | substring_t args[MAX_OPT_ARGS]; | 675 | substring_t args[MAX_OPT_ARGS]; |
| @@ -769,7 +769,7 @@ static int | |||
| 769 | befs_fill_super(struct super_block *sb, void *data, int silent) | 769 | befs_fill_super(struct super_block *sb, void *data, int silent) |
| 770 | { | 770 | { |
| 771 | struct buffer_head *bh; | 771 | struct buffer_head *bh; |
| 772 | befs_sb_info *befs_sb; | 772 | struct befs_sb_info *befs_sb; |
| 773 | befs_super_block *disk_sb; | 773 | befs_super_block *disk_sb; |
| 774 | struct inode *root; | 774 | struct inode *root; |
| 775 | long ret = -EINVAL; | 775 | long ret = -EINVAL; |
diff --git a/fs/befs/super.c b/fs/befs/super.c index ca40f828f64d..aeafc4d84278 100644 --- a/fs/befs/super.c +++ b/fs/befs/super.c | |||
| @@ -24,7 +24,7 @@ | |||
| 24 | int | 24 | int |
| 25 | befs_load_sb(struct super_block *sb, befs_super_block * disk_sb) | 25 | befs_load_sb(struct super_block *sb, befs_super_block * disk_sb) |
| 26 | { | 26 | { |
| 27 | befs_sb_info *befs_sb = BEFS_SB(sb); | 27 | struct befs_sb_info *befs_sb = BEFS_SB(sb); |
| 28 | 28 | ||
| 29 | /* Check the byte order of the filesystem */ | 29 | /* Check the byte order of the filesystem */ |
| 30 | if (disk_sb->fs_byte_order == BEFS_BYTEORDER_NATIVE_LE) | 30 | if (disk_sb->fs_byte_order == BEFS_BYTEORDER_NATIVE_LE) |
| @@ -59,7 +59,7 @@ befs_load_sb(struct super_block *sb, befs_super_block * disk_sb) | |||
| 59 | int | 59 | int |
| 60 | befs_check_sb(struct super_block *sb) | 60 | befs_check_sb(struct super_block *sb) |
| 61 | { | 61 | { |
| 62 | befs_sb_info *befs_sb = BEFS_SB(sb); | 62 | struct befs_sb_info *befs_sb = BEFS_SB(sb); |
| 63 | 63 | ||
| 64 | /* Check magic headers of super block */ | 64 | /* Check magic headers of super block */ |
| 65 | if ((befs_sb->magic1 != BEFS_SUPER_MAGIC1) | 65 | if ((befs_sb->magic1 != BEFS_SUPER_MAGIC1) |
diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c index 08063ae0a17c..7a8182770649 100644 --- a/fs/bfs/dir.c +++ b/fs/bfs/dir.c | |||
| @@ -86,7 +86,7 @@ static int bfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, | |||
| 86 | 86 | ||
| 87 | inode = new_inode(s); | 87 | inode = new_inode(s); |
| 88 | if (!inode) | 88 | if (!inode) |
| 89 | return -ENOSPC; | 89 | return -ENOMEM; |
| 90 | mutex_lock(&info->bfs_lock); | 90 | mutex_lock(&info->bfs_lock); |
| 91 | ino = find_first_zero_bit(info->si_imap, info->si_lasti + 1); | 91 | ino = find_first_zero_bit(info->si_imap, info->si_lasti + 1); |
| 92 | if (ino > info->si_lasti) { | 92 | if (ino > info->si_lasti) { |
| @@ -293,7 +293,7 @@ static int bfs_add_entry(struct inode *dir, const unsigned char *name, | |||
| 293 | for (block = sblock; block <= eblock; block++) { | 293 | for (block = sblock; block <= eblock; block++) { |
| 294 | bh = sb_bread(dir->i_sb, block); | 294 | bh = sb_bread(dir->i_sb, block); |
| 295 | if (!bh) | 295 | if (!bh) |
| 296 | return -ENOSPC; | 296 | return -EIO; |
| 297 | for (off = 0; off < BFS_BSIZE; off += BFS_DIRENT_SIZE) { | 297 | for (off = 0; off < BFS_BSIZE; off += BFS_DIRENT_SIZE) { |
| 298 | de = (struct bfs_dirent *)(bh->b_data + off); | 298 | de = (struct bfs_dirent *)(bh->b_data + off); |
| 299 | if (!de->ino) { | 299 | if (!de->ino) { |
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c index 97aff2879cda..9dcb05409ba7 100644 --- a/fs/binfmt_misc.c +++ b/fs/binfmt_misc.c | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | 9 | ||
| 10 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | 10 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
| 11 | 11 | ||
| 12 | #include <linux/kernel.h> | ||
| 12 | #include <linux/module.h> | 13 | #include <linux/module.h> |
| 13 | #include <linux/init.h> | 14 | #include <linux/init.h> |
| 14 | #include <linux/sched.h> | 15 | #include <linux/sched.h> |
| @@ -521,9 +522,8 @@ static int parse_command(const char __user *buffer, size_t count) | |||
| 521 | 522 | ||
| 522 | static void entry_status(Node *e, char *page) | 523 | static void entry_status(Node *e, char *page) |
| 523 | { | 524 | { |
| 524 | char *dp; | 525 | char *dp = page; |
| 525 | char *status = "disabled"; | 526 | const char *status = "disabled"; |
| 526 | const char *flags = "flags: "; | ||
| 527 | 527 | ||
| 528 | if (test_bit(Enabled, &e->flags)) | 528 | if (test_bit(Enabled, &e->flags)) |
| 529 | status = "enabled"; | 529 | status = "enabled"; |
| @@ -533,12 +533,10 @@ static void entry_status(Node *e, char *page) | |||
| 533 | return; | 533 | return; |
| 534 | } | 534 | } |
| 535 | 535 | ||
| 536 | sprintf(page, "%s\ninterpreter %s\n", status, e->interpreter); | 536 | dp += sprintf(dp, "%s\ninterpreter %s\n", status, e->interpreter); |
| 537 | dp = page + strlen(page); | ||
| 538 | 537 | ||
| 539 | /* print the special flags */ | 538 | /* print the special flags */ |
| 540 | sprintf(dp, "%s", flags); | 539 | dp += sprintf(dp, "flags: "); |
| 541 | dp += strlen(flags); | ||
| 542 | if (e->flags & MISC_FMT_PRESERVE_ARGV0) | 540 | if (e->flags & MISC_FMT_PRESERVE_ARGV0) |
| 543 | *dp++ = 'P'; | 541 | *dp++ = 'P'; |
| 544 | if (e->flags & MISC_FMT_OPEN_BINARY) | 542 | if (e->flags & MISC_FMT_OPEN_BINARY) |
| @@ -550,21 +548,11 @@ static void entry_status(Node *e, char *page) | |||
| 550 | if (!test_bit(Magic, &e->flags)) { | 548 | if (!test_bit(Magic, &e->flags)) { |
| 551 | sprintf(dp, "extension .%s\n", e->magic); | 549 | sprintf(dp, "extension .%s\n", e->magic); |
| 552 | } else { | 550 | } else { |
| 553 | int i; | 551 | dp += sprintf(dp, "offset %i\nmagic ", e->offset); |
| 554 | 552 | dp = bin2hex(dp, e->magic, e->size); | |
| 555 | sprintf(dp, "offset %i\nmagic ", e->offset); | ||
| 556 | dp = page + strlen(page); | ||
| 557 | for (i = 0; i < e->size; i++) { | ||
| 558 | sprintf(dp, "%02x", 0xff & (int) (e->magic[i])); | ||
| 559 | dp += 2; | ||
| 560 | } | ||
| 561 | if (e->mask) { | 553 | if (e->mask) { |
| 562 | sprintf(dp, "\nmask "); | 554 | dp += sprintf(dp, "\nmask "); |
| 563 | dp += 6; | 555 | dp = bin2hex(dp, e->mask, e->size); |
| 564 | for (i = 0; i < e->size; i++) { | ||
| 565 | sprintf(dp, "%02x", 0xff & (int) (e->mask[i])); | ||
| 566 | dp += 2; | ||
| 567 | } | ||
| 568 | } | 556 | } |
| 569 | *dp++ = '\n'; | 557 | *dp++ = '\n'; |
| 570 | *dp = '\0'; | 558 | *dp = '\0'; |
| @@ -926,10 +926,14 @@ static int de_thread(struct task_struct *tsk) | |||
| 926 | if (!thread_group_leader(tsk)) { | 926 | if (!thread_group_leader(tsk)) { |
| 927 | struct task_struct *leader = tsk->group_leader; | 927 | struct task_struct *leader = tsk->group_leader; |
| 928 | 928 | ||
| 929 | sig->notify_count = -1; /* for exit_notify() */ | ||
| 930 | for (;;) { | 929 | for (;;) { |
| 931 | threadgroup_change_begin(tsk); | 930 | threadgroup_change_begin(tsk); |
| 932 | write_lock_irq(&tasklist_lock); | 931 | write_lock_irq(&tasklist_lock); |
| 932 | /* | ||
| 933 | * Do this under tasklist_lock to ensure that | ||
| 934 | * exit_notify() can't miss ->group_exit_task | ||
| 935 | */ | ||
| 936 | sig->notify_count = -1; | ||
| 933 | if (likely(leader->exit_state)) | 937 | if (likely(leader->exit_state)) |
| 934 | break; | 938 | break; |
| 935 | __set_current_state(TASK_KILLABLE); | 939 | __set_current_state(TASK_KILLABLE); |
| @@ -1078,7 +1082,13 @@ int flush_old_exec(struct linux_binprm * bprm) | |||
| 1078 | if (retval) | 1082 | if (retval) |
| 1079 | goto out; | 1083 | goto out; |
| 1080 | 1084 | ||
| 1085 | /* | ||
| 1086 | * Must be called _before_ exec_mmap() as bprm->mm is | ||
| 1087 | * not visibile until then. This also enables the update | ||
| 1088 | * to be lockless. | ||
| 1089 | */ | ||
| 1081 | set_mm_exe_file(bprm->mm, bprm->file); | 1090 | set_mm_exe_file(bprm->mm, bprm->file); |
| 1091 | |||
| 1082 | /* | 1092 | /* |
| 1083 | * Release all of the old mmap stuff | 1093 | * Release all of the old mmap stuff |
| 1084 | */ | 1094 | */ |
diff --git a/fs/fat/cache.c b/fs/fat/cache.c index 91ad9e1c9441..93fc62232ec2 100644 --- a/fs/fat/cache.c +++ b/fs/fat/cache.c | |||
| @@ -8,9 +8,7 @@ | |||
| 8 | * May 1999. AV. Fixed the bogosity with FAT32 (read "FAT28"). Fscking lusers. | 8 | * May 1999. AV. Fixed the bogosity with FAT32 (read "FAT28"). Fscking lusers. |
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | #include <linux/fs.h> | ||
| 12 | #include <linux/slab.h> | 11 | #include <linux/slab.h> |
| 13 | #include <linux/buffer_head.h> | ||
| 14 | #include "fat.h" | 12 | #include "fat.h" |
| 15 | 13 | ||
| 16 | /* this must be > 0. */ | 14 | /* this must be > 0. */ |
diff --git a/fs/fat/dir.c b/fs/fat/dir.c index c5d6bb939d19..4afc4d9d2e41 100644 --- a/fs/fat/dir.c +++ b/fs/fat/dir.c | |||
| @@ -13,13 +13,9 @@ | |||
| 13 | * Short name translation 1999, 2001 by Wolfram Pienkoss <wp@bszh.de> | 13 | * Short name translation 1999, 2001 by Wolfram Pienkoss <wp@bszh.de> |
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | #include <linux/module.h> | ||
| 17 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
| 18 | #include <linux/time.h> | ||
| 19 | #include <linux/buffer_head.h> | ||
| 20 | #include <linux/compat.h> | 17 | #include <linux/compat.h> |
| 21 | #include <linux/uaccess.h> | 18 | #include <linux/uaccess.h> |
| 22 | #include <linux/kernel.h> | ||
| 23 | #include "fat.h" | 19 | #include "fat.h" |
| 24 | 20 | ||
| 25 | /* | 21 | /* |
diff --git a/fs/fat/fat.h b/fs/fat/fat.h index 64e295e8ff38..be5e15323bab 100644 --- a/fs/fat/fat.h +++ b/fs/fat/fat.h | |||
| @@ -2,11 +2,8 @@ | |||
| 2 | #define _FAT_H | 2 | #define _FAT_H |
| 3 | 3 | ||
| 4 | #include <linux/buffer_head.h> | 4 | #include <linux/buffer_head.h> |
| 5 | #include <linux/string.h> | ||
| 6 | #include <linux/nls.h> | 5 | #include <linux/nls.h> |
| 7 | #include <linux/fs.h> | ||
| 8 | #include <linux/hash.h> | 6 | #include <linux/hash.h> |
| 9 | #include <linux/mutex.h> | ||
| 10 | #include <linux/ratelimit.h> | 7 | #include <linux/ratelimit.h> |
| 11 | #include <linux/msdos_fs.h> | 8 | #include <linux/msdos_fs.h> |
| 12 | 9 | ||
| @@ -66,7 +63,7 @@ struct msdos_sb_info { | |||
| 66 | unsigned short sec_per_clus; /* sectors/cluster */ | 63 | unsigned short sec_per_clus; /* sectors/cluster */ |
| 67 | unsigned short cluster_bits; /* log2(cluster_size) */ | 64 | unsigned short cluster_bits; /* log2(cluster_size) */ |
| 68 | unsigned int cluster_size; /* cluster size */ | 65 | unsigned int cluster_size; /* cluster size */ |
| 69 | unsigned char fats, fat_bits; /* number of FATs, FAT bits (12 or 16) */ | 66 | unsigned char fats, fat_bits; /* number of FATs, FAT bits (12,16 or 32) */ |
| 70 | unsigned short fat_start; | 67 | unsigned short fat_start; |
| 71 | unsigned long fat_length; /* FAT start & length (sec.) */ | 68 | unsigned long fat_length; /* FAT start & length (sec.) */ |
| 72 | unsigned long dir_start; | 69 | unsigned long dir_start; |
diff --git a/fs/fat/fatent.c b/fs/fat/fatent.c index 260705c58062..8226557130a2 100644 --- a/fs/fat/fatent.c +++ b/fs/fat/fatent.c | |||
| @@ -3,9 +3,6 @@ | |||
| 3 | * Released under GPL v2. | 3 | * Released under GPL v2. |
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| 6 | #include <linux/module.h> | ||
| 7 | #include <linux/fs.h> | ||
| 8 | #include <linux/msdos_fs.h> | ||
| 9 | #include <linux/blkdev.h> | 6 | #include <linux/blkdev.h> |
| 10 | #include "fat.h" | 7 | #include "fat.h" |
| 11 | 8 | ||
diff --git a/fs/fat/file.c b/fs/fat/file.c index 1e98d333879f..cf50d93565a2 100644 --- a/fs/fat/file.c +++ b/fs/fat/file.c | |||
| @@ -10,10 +10,6 @@ | |||
| 10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
| 11 | #include <linux/compat.h> | 11 | #include <linux/compat.h> |
| 12 | #include <linux/mount.h> | 12 | #include <linux/mount.h> |
| 13 | #include <linux/time.h> | ||
| 14 | #include <linux/buffer_head.h> | ||
| 15 | #include <linux/writeback.h> | ||
| 16 | #include <linux/backing-dev.h> | ||
| 17 | #include <linux/blkdev.h> | 13 | #include <linux/blkdev.h> |
| 18 | #include <linux/fsnotify.h> | 14 | #include <linux/fsnotify.h> |
| 19 | #include <linux/security.h> | 15 | #include <linux/security.h> |
diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 41b729933638..c06774658345 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c | |||
| @@ -11,20 +11,12 @@ | |||
| 11 | */ | 11 | */ |
| 12 | 12 | ||
| 13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
| 14 | #include <linux/init.h> | ||
| 15 | #include <linux/time.h> | ||
| 16 | #include <linux/slab.h> | ||
| 17 | #include <linux/seq_file.h> | ||
| 18 | #include <linux/pagemap.h> | 14 | #include <linux/pagemap.h> |
| 19 | #include <linux/mpage.h> | 15 | #include <linux/mpage.h> |
| 20 | #include <linux/buffer_head.h> | ||
| 21 | #include <linux/mount.h> | ||
| 22 | #include <linux/vfs.h> | 16 | #include <linux/vfs.h> |
| 17 | #include <linux/seq_file.h> | ||
| 23 | #include <linux/parser.h> | 18 | #include <linux/parser.h> |
| 24 | #include <linux/uio.h> | 19 | #include <linux/uio.h> |
| 25 | #include <linux/writeback.h> | ||
| 26 | #include <linux/log2.h> | ||
| 27 | #include <linux/hash.h> | ||
| 28 | #include <linux/blkdev.h> | 20 | #include <linux/blkdev.h> |
| 29 | #include <asm/unaligned.h> | 21 | #include <asm/unaligned.h> |
| 30 | #include "fat.h" | 22 | #include "fat.h" |
| @@ -1278,8 +1270,7 @@ out: | |||
| 1278 | 1270 | ||
| 1279 | static int fat_read_root(struct inode *inode) | 1271 | static int fat_read_root(struct inode *inode) |
| 1280 | { | 1272 | { |
| 1281 | struct super_block *sb = inode->i_sb; | 1273 | struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); |
| 1282 | struct msdos_sb_info *sbi = MSDOS_SB(sb); | ||
| 1283 | int error; | 1274 | int error; |
| 1284 | 1275 | ||
| 1285 | MSDOS_I(inode)->i_pos = MSDOS_ROOT_INO; | 1276 | MSDOS_I(inode)->i_pos = MSDOS_ROOT_INO; |
diff --git a/fs/fat/misc.c b/fs/fat/misc.c index d8da2d2e30ae..c4589e981760 100644 --- a/fs/fat/misc.c +++ b/fs/fat/misc.c | |||
| @@ -6,10 +6,6 @@ | |||
| 6 | * and date_dos2unix for date==0 by Igor Zhbanov(bsg@uniyar.ac.ru) | 6 | * and date_dos2unix for date==0 by Igor Zhbanov(bsg@uniyar.ac.ru) |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #include <linux/module.h> | ||
| 10 | #include <linux/fs.h> | ||
| 11 | #include <linux/buffer_head.h> | ||
| 12 | #include <linux/time.h> | ||
| 13 | #include "fat.h" | 9 | #include "fat.h" |
| 14 | 10 | ||
| 15 | /* | 11 | /* |
diff --git a/fs/fat/namei_msdos.c b/fs/fat/namei_msdos.c index a783b0e1272a..cc6a8541b668 100644 --- a/fs/fat/namei_msdos.c +++ b/fs/fat/namei_msdos.c | |||
| @@ -7,8 +7,6 @@ | |||
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
| 10 | #include <linux/time.h> | ||
| 11 | #include <linux/buffer_head.h> | ||
| 12 | #include "fat.h" | 10 | #include "fat.h" |
| 13 | 11 | ||
| 14 | /* Characters that are undesirable in an MS-DOS file name */ | 12 | /* Characters that are undesirable in an MS-DOS file name */ |
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c index b8b92c2f9683..7e0974eebd8e 100644 --- a/fs/fat/namei_vfat.c +++ b/fs/fat/namei_vfat.c | |||
| @@ -16,10 +16,8 @@ | |||
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
| 19 | #include <linux/jiffies.h> | ||
| 20 | #include <linux/ctype.h> | 19 | #include <linux/ctype.h> |
| 21 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
| 22 | #include <linux/buffer_head.h> | ||
| 23 | #include <linux/namei.h> | 21 | #include <linux/namei.h> |
| 24 | #include "fat.h" | 22 | #include "fat.h" |
| 25 | 23 | ||
| @@ -638,8 +638,7 @@ static struct file *__fget(unsigned int fd, fmode_t mask) | |||
| 638 | file = fcheck_files(files, fd); | 638 | file = fcheck_files(files, fd); |
| 639 | if (file) { | 639 | if (file) { |
| 640 | /* File object ref couldn't be taken */ | 640 | /* File object ref couldn't be taken */ |
| 641 | if ((file->f_mode & mask) || | 641 | if ((file->f_mode & mask) || !get_file_rcu(file)) |
| 642 | !atomic_long_inc_not_zero(&file->f_count)) | ||
| 643 | file = NULL; | 642 | file = NULL; |
| 644 | } | 643 | } |
| 645 | rcu_read_unlock(); | 644 | rcu_read_unlock(); |
diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c index 145566851e7a..36d1a6ae7655 100644 --- a/fs/hfs/dir.c +++ b/fs/hfs/dir.c | |||
| @@ -197,7 +197,7 @@ static int hfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, | |||
| 197 | 197 | ||
| 198 | inode = hfs_new_inode(dir, &dentry->d_name, mode); | 198 | inode = hfs_new_inode(dir, &dentry->d_name, mode); |
| 199 | if (!inode) | 199 | if (!inode) |
| 200 | return -ENOSPC; | 200 | return -ENOMEM; |
| 201 | 201 | ||
| 202 | res = hfs_cat_create(inode->i_ino, dir, &dentry->d_name, inode); | 202 | res = hfs_cat_create(inode->i_ino, dir, &dentry->d_name, inode); |
| 203 | if (res) { | 203 | if (res) { |
| @@ -226,7 +226,7 @@ static int hfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
| 226 | 226 | ||
| 227 | inode = hfs_new_inode(dir, &dentry->d_name, S_IFDIR | mode); | 227 | inode = hfs_new_inode(dir, &dentry->d_name, S_IFDIR | mode); |
| 228 | if (!inode) | 228 | if (!inode) |
| 229 | return -ENOSPC; | 229 | return -ENOMEM; |
| 230 | 230 | ||
| 231 | res = hfs_cat_create(inode->i_ino, dir, &dentry->d_name, inode); | 231 | res = hfs_cat_create(inode->i_ino, dir, &dentry->d_name, inode); |
| 232 | if (res) { | 232 | if (res) { |
diff --git a/fs/hfsplus/bfind.c b/fs/hfsplus/bfind.c index c1422d91cd36..528e38b5af7f 100644 --- a/fs/hfsplus/bfind.c +++ b/fs/hfsplus/bfind.c | |||
| @@ -118,9 +118,7 @@ int __hfs_brec_find(struct hfs_bnode *bnode, struct hfs_find_data *fd, | |||
| 118 | int b, e; | 118 | int b, e; |
| 119 | int res; | 119 | int res; |
| 120 | 120 | ||
| 121 | if (!rec_found) | 121 | BUG_ON(!rec_found); |
| 122 | BUG(); | ||
| 123 | |||
| 124 | b = 0; | 122 | b = 0; |
| 125 | e = bnode->num_recs - 1; | 123 | e = bnode->num_recs - 1; |
| 126 | res = -ENOENT; | 124 | res = -ENOENT; |
diff --git a/fs/hfsplus/catalog.c b/fs/hfsplus/catalog.c index 7892e6fddb66..022974ab6e3c 100644 --- a/fs/hfsplus/catalog.c +++ b/fs/hfsplus/catalog.c | |||
| @@ -350,10 +350,11 @@ int hfsplus_delete_cat(u32 cnid, struct inode *dir, struct qstr *str) | |||
| 350 | &fd.search_key->cat.name.unicode, | 350 | &fd.search_key->cat.name.unicode, |
| 351 | off + 2, len); | 351 | off + 2, len); |
| 352 | fd.search_key->key_len = cpu_to_be16(6 + len); | 352 | fd.search_key->key_len = cpu_to_be16(6 + len); |
| 353 | } else | 353 | } else { |
| 354 | err = hfsplus_cat_build_key(sb, fd.search_key, dir->i_ino, str); | 354 | err = hfsplus_cat_build_key(sb, fd.search_key, dir->i_ino, str); |
| 355 | if (unlikely(err)) | 355 | if (unlikely(err)) |
| 356 | goto out; | 356 | goto out; |
| 357 | } | ||
| 357 | 358 | ||
| 358 | err = hfs_brec_find(&fd, hfs_find_rec_by_key); | 359 | err = hfs_brec_find(&fd, hfs_find_rec_by_key); |
| 359 | if (err) | 360 | if (err) |
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c index f0235c1640af..3074609befc3 100644 --- a/fs/hfsplus/dir.c +++ b/fs/hfsplus/dir.c | |||
| @@ -434,7 +434,7 @@ static int hfsplus_symlink(struct inode *dir, struct dentry *dentry, | |||
| 434 | { | 434 | { |
| 435 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb); | 435 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb); |
| 436 | struct inode *inode; | 436 | struct inode *inode; |
| 437 | int res = -ENOSPC; | 437 | int res = -ENOMEM; |
| 438 | 438 | ||
| 439 | mutex_lock(&sbi->vh_mutex); | 439 | mutex_lock(&sbi->vh_mutex); |
| 440 | inode = hfsplus_new_inode(dir->i_sb, S_IFLNK | S_IRWXUGO); | 440 | inode = hfsplus_new_inode(dir->i_sb, S_IFLNK | S_IRWXUGO); |
| @@ -476,7 +476,7 @@ static int hfsplus_mknod(struct inode *dir, struct dentry *dentry, | |||
| 476 | { | 476 | { |
| 477 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb); | 477 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb); |
| 478 | struct inode *inode; | 478 | struct inode *inode; |
| 479 | int res = -ENOSPC; | 479 | int res = -ENOMEM; |
| 480 | 480 | ||
| 481 | mutex_lock(&sbi->vh_mutex); | 481 | mutex_lock(&sbi->vh_mutex); |
| 482 | inode = hfsplus_new_inode(dir->i_sb, mode); | 482 | inode = hfsplus_new_inode(dir->i_sb, mode); |
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c index a43811f90935..b0afedbef12b 100644 --- a/fs/hfsplus/inode.c +++ b/fs/hfsplus/inode.c | |||
| @@ -253,6 +253,12 @@ static int hfsplus_setattr(struct dentry *dentry, struct iattr *attr) | |||
| 253 | if ((attr->ia_valid & ATTR_SIZE) && | 253 | if ((attr->ia_valid & ATTR_SIZE) && |
| 254 | attr->ia_size != i_size_read(inode)) { | 254 | attr->ia_size != i_size_read(inode)) { |
| 255 | inode_dio_wait(inode); | 255 | inode_dio_wait(inode); |
| 256 | if (attr->ia_size > inode->i_size) { | ||
| 257 | error = generic_cont_expand_simple(inode, | ||
| 258 | attr->ia_size); | ||
| 259 | if (error) | ||
| 260 | return error; | ||
| 261 | } | ||
| 256 | truncate_setsize(inode, attr->ia_size); | 262 | truncate_setsize(inode, attr->ia_size); |
| 257 | hfsplus_file_truncate(inode); | 263 | hfsplus_file_truncate(inode); |
| 258 | } | 264 | } |
diff --git a/fs/hfsplus/ioctl.c b/fs/hfsplus/ioctl.c index d3ff5cc317d7..8e98f5db6ad6 100644 --- a/fs/hfsplus/ioctl.c +++ b/fs/hfsplus/ioctl.c | |||
| @@ -76,7 +76,7 @@ static int hfsplus_ioctl_setflags(struct file *file, int __user *user_flags) | |||
| 76 | { | 76 | { |
| 77 | struct inode *inode = file_inode(file); | 77 | struct inode *inode = file_inode(file); |
| 78 | struct hfsplus_inode_info *hip = HFSPLUS_I(inode); | 78 | struct hfsplus_inode_info *hip = HFSPLUS_I(inode); |
| 79 | unsigned int flags; | 79 | unsigned int flags, new_fl = 0; |
| 80 | int err = 0; | 80 | int err = 0; |
| 81 | 81 | ||
| 82 | err = mnt_want_write_file(file); | 82 | err = mnt_want_write_file(file); |
| @@ -110,14 +110,12 @@ static int hfsplus_ioctl_setflags(struct file *file, int __user *user_flags) | |||
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | if (flags & FS_IMMUTABLE_FL) | 112 | if (flags & FS_IMMUTABLE_FL) |
| 113 | inode->i_flags |= S_IMMUTABLE; | 113 | new_fl |= S_IMMUTABLE; |
| 114 | else | ||
| 115 | inode->i_flags &= ~S_IMMUTABLE; | ||
| 116 | 114 | ||
| 117 | if (flags & FS_APPEND_FL) | 115 | if (flags & FS_APPEND_FL) |
| 118 | inode->i_flags |= S_APPEND; | 116 | new_fl |= S_APPEND; |
| 119 | else | 117 | |
| 120 | inode->i_flags &= ~S_APPEND; | 118 | inode_set_flags(inode, new_fl, S_IMMUTABLE | S_APPEND); |
| 121 | 119 | ||
| 122 | if (flags & FS_NODUMP_FL) | 120 | if (flags & FS_NODUMP_FL) |
| 123 | hip->userflags |= HFSPLUS_FLG_NODUMP; | 121 | hip->userflags |= HFSPLUS_FLG_NODUMP; |
diff --git a/fs/hfsplus/xattr.c b/fs/hfsplus/xattr.c index d98094a9f476..89f262d8fcd8 100644 --- a/fs/hfsplus/xattr.c +++ b/fs/hfsplus/xattr.c | |||
| @@ -44,7 +44,7 @@ static int strcmp_xattr_acl(const char *name) | |||
| 44 | return -1; | 44 | return -1; |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | static inline int is_known_namespace(const char *name) | 47 | static bool is_known_namespace(const char *name) |
| 48 | { | 48 | { |
| 49 | if (strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN) && | 49 | if (strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN) && |
| 50 | strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN) && | 50 | strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN) && |
| @@ -424,6 +424,28 @@ static int copy_name(char *buffer, const char *xattr_name, int name_len) | |||
| 424 | return len; | 424 | return len; |
| 425 | } | 425 | } |
| 426 | 426 | ||
| 427 | int hfsplus_setxattr(struct dentry *dentry, const char *name, | ||
| 428 | const void *value, size_t size, int flags, | ||
| 429 | const char *prefix, size_t prefixlen) | ||
| 430 | { | ||
| 431 | char *xattr_name; | ||
| 432 | int res; | ||
| 433 | |||
| 434 | if (!strcmp(name, "")) | ||
| 435 | return -EINVAL; | ||
| 436 | |||
| 437 | xattr_name = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN + 1, | ||
| 438 | GFP_KERNEL); | ||
| 439 | if (!xattr_name) | ||
| 440 | return -ENOMEM; | ||
| 441 | strcpy(xattr_name, prefix); | ||
| 442 | strcpy(xattr_name + prefixlen, name); | ||
| 443 | res = __hfsplus_setxattr(dentry->d_inode, xattr_name, value, size, | ||
| 444 | flags); | ||
| 445 | kfree(xattr_name); | ||
| 446 | return res; | ||
| 447 | } | ||
| 448 | |||
| 427 | static ssize_t hfsplus_getxattr_finder_info(struct inode *inode, | 449 | static ssize_t hfsplus_getxattr_finder_info(struct inode *inode, |
| 428 | void *value, size_t size) | 450 | void *value, size_t size) |
| 429 | { | 451 | { |
| @@ -560,6 +582,30 @@ failed_getxattr_init: | |||
| 560 | return res; | 582 | return res; |
| 561 | } | 583 | } |
| 562 | 584 | ||
| 585 | ssize_t hfsplus_getxattr(struct dentry *dentry, const char *name, | ||
| 586 | void *value, size_t size, | ||
| 587 | const char *prefix, size_t prefixlen) | ||
| 588 | { | ||
| 589 | int res; | ||
| 590 | char *xattr_name; | ||
| 591 | |||
| 592 | if (!strcmp(name, "")) | ||
| 593 | return -EINVAL; | ||
| 594 | |||
| 595 | xattr_name = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN + 1, | ||
| 596 | GFP_KERNEL); | ||
| 597 | if (!xattr_name) | ||
| 598 | return -ENOMEM; | ||
| 599 | |||
| 600 | strcpy(xattr_name, prefix); | ||
| 601 | strcpy(xattr_name + prefixlen, name); | ||
| 602 | |||
| 603 | res = __hfsplus_getxattr(dentry->d_inode, xattr_name, value, size); | ||
| 604 | kfree(xattr_name); | ||
| 605 | return res; | ||
| 606 | |||
| 607 | } | ||
| 608 | |||
| 563 | static inline int can_list(const char *xattr_name) | 609 | static inline int can_list(const char *xattr_name) |
| 564 | { | 610 | { |
| 565 | if (!xattr_name) | 611 | if (!xattr_name) |
| @@ -806,9 +852,6 @@ end_removexattr: | |||
| 806 | static int hfsplus_osx_getxattr(struct dentry *dentry, const char *name, | 852 | static int hfsplus_osx_getxattr(struct dentry *dentry, const char *name, |
| 807 | void *buffer, size_t size, int type) | 853 | void *buffer, size_t size, int type) |
| 808 | { | 854 | { |
| 809 | char *xattr_name; | ||
| 810 | int res; | ||
| 811 | |||
| 812 | if (!strcmp(name, "")) | 855 | if (!strcmp(name, "")) |
| 813 | return -EINVAL; | 856 | return -EINVAL; |
| 814 | 857 | ||
| @@ -818,24 +861,19 @@ static int hfsplus_osx_getxattr(struct dentry *dentry, const char *name, | |||
| 818 | */ | 861 | */ |
| 819 | if (is_known_namespace(name)) | 862 | if (is_known_namespace(name)) |
| 820 | return -EOPNOTSUPP; | 863 | return -EOPNOTSUPP; |
| 821 | xattr_name = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN | ||
| 822 | + XATTR_MAC_OSX_PREFIX_LEN + 1, GFP_KERNEL); | ||
| 823 | if (!xattr_name) | ||
| 824 | return -ENOMEM; | ||
| 825 | strcpy(xattr_name, XATTR_MAC_OSX_PREFIX); | ||
| 826 | strcpy(xattr_name + XATTR_MAC_OSX_PREFIX_LEN, name); | ||
| 827 | 864 | ||
| 828 | res = hfsplus_getxattr(dentry, xattr_name, buffer, size); | 865 | /* |
| 829 | kfree(xattr_name); | 866 | * osx is the namespace we use to indicate an unprefixed |
| 830 | return res; | 867 | * attribute on the filesystem (like the ones that OS X |
| 868 | * creates), so we pass the name through unmodified (after | ||
| 869 | * ensuring it doesn't conflict with another namespace). | ||
| 870 | */ | ||
| 871 | return __hfsplus_getxattr(dentry->d_inode, name, buffer, size); | ||
| 831 | } | 872 | } |
| 832 | 873 | ||
| 833 | static int hfsplus_osx_setxattr(struct dentry *dentry, const char *name, | 874 | static int hfsplus_osx_setxattr(struct dentry *dentry, const char *name, |
| 834 | const void *buffer, size_t size, int flags, int type) | 875 | const void *buffer, size_t size, int flags, int type) |
| 835 | { | 876 | { |
| 836 | char *xattr_name; | ||
| 837 | int res; | ||
| 838 | |||
| 839 | if (!strcmp(name, "")) | 877 | if (!strcmp(name, "")) |
| 840 | return -EINVAL; | 878 | return -EINVAL; |
| 841 | 879 | ||
| @@ -845,16 +883,14 @@ static int hfsplus_osx_setxattr(struct dentry *dentry, const char *name, | |||
| 845 | */ | 883 | */ |
| 846 | if (is_known_namespace(name)) | 884 | if (is_known_namespace(name)) |
| 847 | return -EOPNOTSUPP; | 885 | return -EOPNOTSUPP; |
| 848 | xattr_name = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN | ||
| 849 | + XATTR_MAC_OSX_PREFIX_LEN + 1, GFP_KERNEL); | ||
| 850 | if (!xattr_name) | ||
| 851 | return -ENOMEM; | ||
| 852 | strcpy(xattr_name, XATTR_MAC_OSX_PREFIX); | ||
| 853 | strcpy(xattr_name + XATTR_MAC_OSX_PREFIX_LEN, name); | ||
| 854 | 886 | ||
| 855 | res = hfsplus_setxattr(dentry, xattr_name, buffer, size, flags); | 887 | /* |
| 856 | kfree(xattr_name); | 888 | * osx is the namespace we use to indicate an unprefixed |
| 857 | return res; | 889 | * attribute on the filesystem (like the ones that OS X |
| 890 | * creates), so we pass the name through unmodified (after | ||
| 891 | * ensuring it doesn't conflict with another namespace). | ||
| 892 | */ | ||
| 893 | return __hfsplus_setxattr(dentry->d_inode, name, buffer, size, flags); | ||
| 858 | } | 894 | } |
| 859 | 895 | ||
| 860 | static size_t hfsplus_osx_listxattr(struct dentry *dentry, char *list, | 896 | static size_t hfsplus_osx_listxattr(struct dentry *dentry, char *list, |
diff --git a/fs/hfsplus/xattr.h b/fs/hfsplus/xattr.h index 288530cf80b5..f9b0955b3d28 100644 --- a/fs/hfsplus/xattr.h +++ b/fs/hfsplus/xattr.h | |||
| @@ -21,22 +21,16 @@ extern const struct xattr_handler *hfsplus_xattr_handlers[]; | |||
| 21 | int __hfsplus_setxattr(struct inode *inode, const char *name, | 21 | int __hfsplus_setxattr(struct inode *inode, const char *name, |
| 22 | const void *value, size_t size, int flags); | 22 | const void *value, size_t size, int flags); |
| 23 | 23 | ||
| 24 | static inline int hfsplus_setxattr(struct dentry *dentry, const char *name, | 24 | int hfsplus_setxattr(struct dentry *dentry, const char *name, |
| 25 | const void *value, size_t size, int flags) | 25 | const void *value, size_t size, int flags, |
| 26 | { | 26 | const char *prefix, size_t prefixlen); |
| 27 | return __hfsplus_setxattr(dentry->d_inode, name, value, size, flags); | ||
| 28 | } | ||
| 29 | 27 | ||
| 30 | ssize_t __hfsplus_getxattr(struct inode *inode, const char *name, | 28 | ssize_t __hfsplus_getxattr(struct inode *inode, const char *name, |
| 31 | void *value, size_t size); | 29 | void *value, size_t size); |
| 32 | 30 | ||
| 33 | static inline ssize_t hfsplus_getxattr(struct dentry *dentry, | 31 | ssize_t hfsplus_getxattr(struct dentry *dentry, const char *name, |
| 34 | const char *name, | 32 | void *value, size_t size, |
| 35 | void *value, | 33 | const char *prefix, size_t prefixlen); |
| 36 | size_t size) | ||
| 37 | { | ||
| 38 | return __hfsplus_getxattr(dentry->d_inode, name, value, size); | ||
| 39 | } | ||
| 40 | 34 | ||
| 41 | ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size); | 35 | ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size); |
| 42 | 36 | ||
diff --git a/fs/hfsplus/xattr_security.c b/fs/hfsplus/xattr_security.c index 6ec5e107691f..aacff00a9ff9 100644 --- a/fs/hfsplus/xattr_security.c +++ b/fs/hfsplus/xattr_security.c | |||
| @@ -16,43 +16,17 @@ | |||
| 16 | static int hfsplus_security_getxattr(struct dentry *dentry, const char *name, | 16 | static int hfsplus_security_getxattr(struct dentry *dentry, const char *name, |
| 17 | void *buffer, size_t size, int type) | 17 | void *buffer, size_t size, int type) |
| 18 | { | 18 | { |
| 19 | char *xattr_name; | 19 | return hfsplus_getxattr(dentry, name, buffer, size, |
| 20 | int res; | 20 | XATTR_SECURITY_PREFIX, |
| 21 | 21 | XATTR_SECURITY_PREFIX_LEN); | |
| 22 | if (!strcmp(name, "")) | ||
| 23 | return -EINVAL; | ||
| 24 | |||
| 25 | xattr_name = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN + 1, | ||
| 26 | GFP_KERNEL); | ||
| 27 | if (!xattr_name) | ||
| 28 | return -ENOMEM; | ||
| 29 | strcpy(xattr_name, XATTR_SECURITY_PREFIX); | ||
| 30 | strcpy(xattr_name + XATTR_SECURITY_PREFIX_LEN, name); | ||
| 31 | |||
| 32 | res = hfsplus_getxattr(dentry, xattr_name, buffer, size); | ||
| 33 | kfree(xattr_name); | ||
| 34 | return res; | ||
| 35 | } | 22 | } |
| 36 | 23 | ||
| 37 | static int hfsplus_security_setxattr(struct dentry *dentry, const char *name, | 24 | static int hfsplus_security_setxattr(struct dentry *dentry, const char *name, |
| 38 | const void *buffer, size_t size, int flags, int type) | 25 | const void *buffer, size_t size, int flags, int type) |
| 39 | { | 26 | { |
| 40 | char *xattr_name; | 27 | return hfsplus_setxattr(dentry, name, buffer, size, flags, |
| 41 | int res; | 28 | XATTR_SECURITY_PREFIX, |
| 42 | 29 | XATTR_SECURITY_PREFIX_LEN); | |
| 43 | if (!strcmp(name, "")) | ||
| 44 | return -EINVAL; | ||
| 45 | |||
| 46 | xattr_name = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN + 1, | ||
| 47 | GFP_KERNEL); | ||
| 48 | if (!xattr_name) | ||
| 49 | return -ENOMEM; | ||
| 50 | strcpy(xattr_name, XATTR_SECURITY_PREFIX); | ||
| 51 | strcpy(xattr_name + XATTR_SECURITY_PREFIX_LEN, name); | ||
| 52 | |||
| 53 | res = hfsplus_setxattr(dentry, xattr_name, buffer, size, flags); | ||
| 54 | kfree(xattr_name); | ||
| 55 | return res; | ||
| 56 | } | 30 | } |
| 57 | 31 | ||
| 58 | static size_t hfsplus_security_listxattr(struct dentry *dentry, char *list, | 32 | static size_t hfsplus_security_listxattr(struct dentry *dentry, char *list, |
diff --git a/fs/hfsplus/xattr_trusted.c b/fs/hfsplus/xattr_trusted.c index 3c5f27e4746a..bcf65089b7f7 100644 --- a/fs/hfsplus/xattr_trusted.c +++ b/fs/hfsplus/xattr_trusted.c | |||
| @@ -14,43 +14,16 @@ | |||
| 14 | static int hfsplus_trusted_getxattr(struct dentry *dentry, const char *name, | 14 | static int hfsplus_trusted_getxattr(struct dentry *dentry, const char *name, |
| 15 | void *buffer, size_t size, int type) | 15 | void *buffer, size_t size, int type) |
| 16 | { | 16 | { |
| 17 | char *xattr_name; | 17 | return hfsplus_getxattr(dentry, name, buffer, size, |
| 18 | int res; | 18 | XATTR_TRUSTED_PREFIX, |
| 19 | 19 | XATTR_TRUSTED_PREFIX_LEN); | |
| 20 | if (!strcmp(name, "")) | ||
| 21 | return -EINVAL; | ||
| 22 | |||
| 23 | xattr_name = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN + 1, | ||
| 24 | GFP_KERNEL); | ||
| 25 | if (!xattr_name) | ||
| 26 | return -ENOMEM; | ||
| 27 | strcpy(xattr_name, XATTR_TRUSTED_PREFIX); | ||
| 28 | strcpy(xattr_name + XATTR_TRUSTED_PREFIX_LEN, name); | ||
| 29 | |||
| 30 | res = hfsplus_getxattr(dentry, xattr_name, buffer, size); | ||
| 31 | kfree(xattr_name); | ||
| 32 | return res; | ||
| 33 | } | 20 | } |
| 34 | 21 | ||
| 35 | static int hfsplus_trusted_setxattr(struct dentry *dentry, const char *name, | 22 | static int hfsplus_trusted_setxattr(struct dentry *dentry, const char *name, |
| 36 | const void *buffer, size_t size, int flags, int type) | 23 | const void *buffer, size_t size, int flags, int type) |
| 37 | { | 24 | { |
| 38 | char *xattr_name; | 25 | return hfsplus_setxattr(dentry, name, buffer, size, flags, |
| 39 | int res; | 26 | XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN); |
| 40 | |||
| 41 | if (!strcmp(name, "")) | ||
| 42 | return -EINVAL; | ||
| 43 | |||
| 44 | xattr_name = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN + 1, | ||
| 45 | GFP_KERNEL); | ||
| 46 | if (!xattr_name) | ||
| 47 | return -ENOMEM; | ||
| 48 | strcpy(xattr_name, XATTR_TRUSTED_PREFIX); | ||
| 49 | strcpy(xattr_name + XATTR_TRUSTED_PREFIX_LEN, name); | ||
| 50 | |||
| 51 | res = hfsplus_setxattr(dentry, xattr_name, buffer, size, flags); | ||
| 52 | kfree(xattr_name); | ||
| 53 | return res; | ||
| 54 | } | 27 | } |
| 55 | 28 | ||
| 56 | static size_t hfsplus_trusted_listxattr(struct dentry *dentry, char *list, | 29 | static size_t hfsplus_trusted_listxattr(struct dentry *dentry, char *list, |
diff --git a/fs/hfsplus/xattr_user.c b/fs/hfsplus/xattr_user.c index 2b625a538b64..5aa0e6dc4a1e 100644 --- a/fs/hfsplus/xattr_user.c +++ b/fs/hfsplus/xattr_user.c | |||
| @@ -14,43 +14,16 @@ | |||
| 14 | static int hfsplus_user_getxattr(struct dentry *dentry, const char *name, | 14 | static int hfsplus_user_getxattr(struct dentry *dentry, const char *name, |
| 15 | void *buffer, size_t size, int type) | 15 | void *buffer, size_t size, int type) |
| 16 | { | 16 | { |
| 17 | char *xattr_name; | ||
| 18 | int res; | ||
| 19 | 17 | ||
| 20 | if (!strcmp(name, "")) | 18 | return hfsplus_getxattr(dentry, name, buffer, size, |
| 21 | return -EINVAL; | 19 | XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN); |
| 22 | |||
| 23 | xattr_name = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN + 1, | ||
| 24 | GFP_KERNEL); | ||
| 25 | if (!xattr_name) | ||
| 26 | return -ENOMEM; | ||
| 27 | strcpy(xattr_name, XATTR_USER_PREFIX); | ||
| 28 | strcpy(xattr_name + XATTR_USER_PREFIX_LEN, name); | ||
| 29 | |||
| 30 | res = hfsplus_getxattr(dentry, xattr_name, buffer, size); | ||
| 31 | kfree(xattr_name); | ||
| 32 | return res; | ||
| 33 | } | 20 | } |
| 34 | 21 | ||
| 35 | static int hfsplus_user_setxattr(struct dentry *dentry, const char *name, | 22 | static int hfsplus_user_setxattr(struct dentry *dentry, const char *name, |
| 36 | const void *buffer, size_t size, int flags, int type) | 23 | const void *buffer, size_t size, int flags, int type) |
| 37 | { | 24 | { |
| 38 | char *xattr_name; | 25 | return hfsplus_setxattr(dentry, name, buffer, size, flags, |
| 39 | int res; | 26 | XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN); |
| 40 | |||
| 41 | if (!strcmp(name, "")) | ||
| 42 | return -EINVAL; | ||
| 43 | |||
| 44 | xattr_name = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN + 1, | ||
| 45 | GFP_KERNEL); | ||
| 46 | if (!xattr_name) | ||
| 47 | return -ENOMEM; | ||
| 48 | strcpy(xattr_name, XATTR_USER_PREFIX); | ||
| 49 | strcpy(xattr_name + XATTR_USER_PREFIX_LEN, name); | ||
| 50 | |||
| 51 | res = hfsplus_setxattr(dentry, xattr_name, buffer, size, flags); | ||
| 52 | kfree(xattr_name); | ||
| 53 | return res; | ||
| 54 | } | 27 | } |
| 55 | 28 | ||
| 56 | static size_t hfsplus_user_listxattr(struct dentry *dentry, char *list, | 29 | static size_t hfsplus_user_listxattr(struct dentry *dentry, char *list, |
diff --git a/fs/locks.c b/fs/locks.c index 52b780fb5258..653faabb07f4 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
| @@ -2590,6 +2590,44 @@ static int locks_show(struct seq_file *f, void *v) | |||
| 2590 | return 0; | 2590 | return 0; |
| 2591 | } | 2591 | } |
| 2592 | 2592 | ||
| 2593 | static void __show_fd_locks(struct seq_file *f, | ||
| 2594 | struct list_head *head, int *id, | ||
| 2595 | struct file *filp, struct files_struct *files) | ||
| 2596 | { | ||
| 2597 | struct file_lock *fl; | ||
| 2598 | |||
| 2599 | list_for_each_entry(fl, head, fl_list) { | ||
| 2600 | |||
| 2601 | if (filp != fl->fl_file) | ||
| 2602 | continue; | ||
| 2603 | if (fl->fl_owner != files && | ||
| 2604 | fl->fl_owner != filp) | ||
| 2605 | continue; | ||
| 2606 | |||
| 2607 | (*id)++; | ||
| 2608 | seq_puts(f, "lock:\t"); | ||
| 2609 | lock_get_status(f, fl, *id, ""); | ||
| 2610 | } | ||
| 2611 | } | ||
| 2612 | |||
| 2613 | void show_fd_locks(struct seq_file *f, | ||
| 2614 | struct file *filp, struct files_struct *files) | ||
| 2615 | { | ||
| 2616 | struct inode *inode = file_inode(filp); | ||
| 2617 | struct file_lock_context *ctx; | ||
| 2618 | int id = 0; | ||
| 2619 | |||
| 2620 | ctx = inode->i_flctx; | ||
| 2621 | if (!ctx) | ||
| 2622 | return; | ||
| 2623 | |||
| 2624 | spin_lock(&ctx->flc_lock); | ||
| 2625 | __show_fd_locks(f, &ctx->flc_flock, &id, filp, files); | ||
| 2626 | __show_fd_locks(f, &ctx->flc_posix, &id, filp, files); | ||
| 2627 | __show_fd_locks(f, &ctx->flc_lease, &id, filp, files); | ||
| 2628 | spin_unlock(&ctx->flc_lock); | ||
| 2629 | } | ||
| 2630 | |||
| 2593 | static void *locks_start(struct seq_file *f, loff_t *pos) | 2631 | static void *locks_start(struct seq_file *f, loff_t *pos) |
| 2594 | __acquires(&blocked_lock_lock) | 2632 | __acquires(&blocked_lock_lock) |
| 2595 | { | 2633 | { |
diff --git a/fs/nilfs2/alloc.c b/fs/nilfs2/alloc.c index 741fd02e0444..8df0f3b7839b 100644 --- a/fs/nilfs2/alloc.c +++ b/fs/nilfs2/alloc.c | |||
| @@ -405,13 +405,14 @@ nilfs_palloc_rest_groups_in_desc_block(const struct inode *inode, | |||
| 405 | static int nilfs_palloc_count_desc_blocks(struct inode *inode, | 405 | static int nilfs_palloc_count_desc_blocks(struct inode *inode, |
| 406 | unsigned long *desc_blocks) | 406 | unsigned long *desc_blocks) |
| 407 | { | 407 | { |
| 408 | unsigned long blknum; | 408 | __u64 blknum; |
| 409 | int ret; | 409 | int ret; |
| 410 | 410 | ||
| 411 | ret = nilfs_bmap_last_key(NILFS_I(inode)->i_bmap, &blknum); | 411 | ret = nilfs_bmap_last_key(NILFS_I(inode)->i_bmap, &blknum); |
| 412 | if (likely(!ret)) | 412 | if (likely(!ret)) |
| 413 | *desc_blocks = DIV_ROUND_UP( | 413 | *desc_blocks = DIV_ROUND_UP( |
| 414 | blknum, NILFS_MDT(inode)->mi_blocks_per_desc_block); | 414 | (unsigned long)blknum, |
| 415 | NILFS_MDT(inode)->mi_blocks_per_desc_block); | ||
| 415 | return ret; | 416 | return ret; |
| 416 | } | 417 | } |
| 417 | 418 | ||
diff --git a/fs/nilfs2/bmap.c b/fs/nilfs2/bmap.c index aadbd0b5e3e8..27f75bcbeb30 100644 --- a/fs/nilfs2/bmap.c +++ b/fs/nilfs2/bmap.c | |||
| @@ -152,9 +152,7 @@ static int nilfs_bmap_do_insert(struct nilfs_bmap *bmap, __u64 key, __u64 ptr) | |||
| 152 | * | 152 | * |
| 153 | * %-EEXIST - A record associated with @key already exist. | 153 | * %-EEXIST - A record associated with @key already exist. |
| 154 | */ | 154 | */ |
| 155 | int nilfs_bmap_insert(struct nilfs_bmap *bmap, | 155 | int nilfs_bmap_insert(struct nilfs_bmap *bmap, __u64 key, unsigned long rec) |
| 156 | unsigned long key, | ||
| 157 | unsigned long rec) | ||
| 158 | { | 156 | { |
| 159 | int ret; | 157 | int ret; |
| 160 | 158 | ||
| @@ -191,19 +189,47 @@ static int nilfs_bmap_do_delete(struct nilfs_bmap *bmap, __u64 key) | |||
| 191 | return bmap->b_ops->bop_delete(bmap, key); | 189 | return bmap->b_ops->bop_delete(bmap, key); |
| 192 | } | 190 | } |
| 193 | 191 | ||
| 194 | int nilfs_bmap_last_key(struct nilfs_bmap *bmap, unsigned long *key) | 192 | /** |
| 193 | * nilfs_bmap_seek_key - seek a valid entry and return its key | ||
| 194 | * @bmap: bmap struct | ||
| 195 | * @start: start key number | ||
| 196 | * @keyp: place to store valid key | ||
| 197 | * | ||
| 198 | * Description: nilfs_bmap_seek_key() seeks a valid key on @bmap | ||
| 199 | * starting from @start, and stores it to @keyp if found. | ||
| 200 | * | ||
| 201 | * Return Value: On success, 0 is returned. On error, one of the following | ||
| 202 | * negative error codes is returned. | ||
| 203 | * | ||
| 204 | * %-EIO - I/O error. | ||
| 205 | * | ||
| 206 | * %-ENOMEM - Insufficient amount of memory available. | ||
| 207 | * | ||
| 208 | * %-ENOENT - No valid entry was found | ||
| 209 | */ | ||
| 210 | int nilfs_bmap_seek_key(struct nilfs_bmap *bmap, __u64 start, __u64 *keyp) | ||
| 195 | { | 211 | { |
| 196 | __u64 lastkey; | ||
| 197 | int ret; | 212 | int ret; |
| 198 | 213 | ||
| 199 | down_read(&bmap->b_sem); | 214 | down_read(&bmap->b_sem); |
| 200 | ret = bmap->b_ops->bop_last_key(bmap, &lastkey); | 215 | ret = bmap->b_ops->bop_seek_key(bmap, start, keyp); |
| 216 | up_read(&bmap->b_sem); | ||
| 217 | |||
| 218 | if (ret < 0) | ||
| 219 | ret = nilfs_bmap_convert_error(bmap, __func__, ret); | ||
| 220 | return ret; | ||
| 221 | } | ||
| 222 | |||
| 223 | int nilfs_bmap_last_key(struct nilfs_bmap *bmap, __u64 *keyp) | ||
| 224 | { | ||
| 225 | int ret; | ||
| 226 | |||
| 227 | down_read(&bmap->b_sem); | ||
| 228 | ret = bmap->b_ops->bop_last_key(bmap, keyp); | ||
| 201 | up_read(&bmap->b_sem); | 229 | up_read(&bmap->b_sem); |
| 202 | 230 | ||
| 203 | if (ret < 0) | 231 | if (ret < 0) |
| 204 | ret = nilfs_bmap_convert_error(bmap, __func__, ret); | 232 | ret = nilfs_bmap_convert_error(bmap, __func__, ret); |
| 205 | else | ||
| 206 | *key = lastkey; | ||
| 207 | return ret; | 233 | return ret; |
| 208 | } | 234 | } |
| 209 | 235 | ||
| @@ -224,7 +250,7 @@ int nilfs_bmap_last_key(struct nilfs_bmap *bmap, unsigned long *key) | |||
| 224 | * | 250 | * |
| 225 | * %-ENOENT - A record associated with @key does not exist. | 251 | * %-ENOENT - A record associated with @key does not exist. |
| 226 | */ | 252 | */ |
| 227 | int nilfs_bmap_delete(struct nilfs_bmap *bmap, unsigned long key) | 253 | int nilfs_bmap_delete(struct nilfs_bmap *bmap, __u64 key) |
| 228 | { | 254 | { |
| 229 | int ret; | 255 | int ret; |
| 230 | 256 | ||
| @@ -235,7 +261,7 @@ int nilfs_bmap_delete(struct nilfs_bmap *bmap, unsigned long key) | |||
| 235 | return nilfs_bmap_convert_error(bmap, __func__, ret); | 261 | return nilfs_bmap_convert_error(bmap, __func__, ret); |
| 236 | } | 262 | } |
| 237 | 263 | ||
| 238 | static int nilfs_bmap_do_truncate(struct nilfs_bmap *bmap, unsigned long key) | 264 | static int nilfs_bmap_do_truncate(struct nilfs_bmap *bmap, __u64 key) |
| 239 | { | 265 | { |
| 240 | __u64 lastkey; | 266 | __u64 lastkey; |
| 241 | int ret; | 267 | int ret; |
| @@ -276,7 +302,7 @@ static int nilfs_bmap_do_truncate(struct nilfs_bmap *bmap, unsigned long key) | |||
| 276 | * | 302 | * |
| 277 | * %-ENOMEM - Insufficient amount of memory available. | 303 | * %-ENOMEM - Insufficient amount of memory available. |
| 278 | */ | 304 | */ |
| 279 | int nilfs_bmap_truncate(struct nilfs_bmap *bmap, unsigned long key) | 305 | int nilfs_bmap_truncate(struct nilfs_bmap *bmap, __u64 key) |
| 280 | { | 306 | { |
| 281 | int ret; | 307 | int ret; |
| 282 | 308 | ||
diff --git a/fs/nilfs2/bmap.h b/fs/nilfs2/bmap.h index b89e68076adc..bfa817ce40b3 100644 --- a/fs/nilfs2/bmap.h +++ b/fs/nilfs2/bmap.h | |||
| @@ -76,8 +76,10 @@ struct nilfs_bmap_operations { | |||
| 76 | union nilfs_binfo *); | 76 | union nilfs_binfo *); |
| 77 | int (*bop_mark)(struct nilfs_bmap *, __u64, int); | 77 | int (*bop_mark)(struct nilfs_bmap *, __u64, int); |
| 78 | 78 | ||
| 79 | /* The following functions are internal use only. */ | 79 | int (*bop_seek_key)(const struct nilfs_bmap *, __u64, __u64 *); |
| 80 | int (*bop_last_key)(const struct nilfs_bmap *, __u64 *); | 80 | int (*bop_last_key)(const struct nilfs_bmap *, __u64 *); |
| 81 | |||
| 82 | /* The following functions are internal use only. */ | ||
| 81 | int (*bop_check_insert)(const struct nilfs_bmap *, __u64); | 83 | int (*bop_check_insert)(const struct nilfs_bmap *, __u64); |
| 82 | int (*bop_check_delete)(struct nilfs_bmap *, __u64); | 84 | int (*bop_check_delete)(struct nilfs_bmap *, __u64); |
| 83 | int (*bop_gather_data)(struct nilfs_bmap *, __u64 *, __u64 *, int); | 85 | int (*bop_gather_data)(struct nilfs_bmap *, __u64 *, __u64 *, int); |
| @@ -153,10 +155,11 @@ int nilfs_bmap_test_and_clear_dirty(struct nilfs_bmap *); | |||
| 153 | int nilfs_bmap_read(struct nilfs_bmap *, struct nilfs_inode *); | 155 | int nilfs_bmap_read(struct nilfs_bmap *, struct nilfs_inode *); |
| 154 | void nilfs_bmap_write(struct nilfs_bmap *, struct nilfs_inode *); | 156 | void nilfs_bmap_write(struct nilfs_bmap *, struct nilfs_inode *); |
| 155 | int nilfs_bmap_lookup_contig(struct nilfs_bmap *, __u64, __u64 *, unsigned); | 157 | int nilfs_bmap_lookup_contig(struct nilfs_bmap *, __u64, __u64 *, unsigned); |
| 156 | int nilfs_bmap_insert(struct nilfs_bmap *, unsigned long, unsigned long); | 158 | int nilfs_bmap_insert(struct nilfs_bmap *bmap, __u64 key, unsigned long rec); |
| 157 | int nilfs_bmap_delete(struct nilfs_bmap *, unsigned long); | 159 | int nilfs_bmap_delete(struct nilfs_bmap *bmap, __u64 key); |
| 158 | int nilfs_bmap_last_key(struct nilfs_bmap *, unsigned long *); | 160 | int nilfs_bmap_seek_key(struct nilfs_bmap *bmap, __u64 start, __u64 *keyp); |
| 159 | int nilfs_bmap_truncate(struct nilfs_bmap *, unsigned long); | 161 | int nilfs_bmap_last_key(struct nilfs_bmap *bmap, __u64 *keyp); |
| 162 | int nilfs_bmap_truncate(struct nilfs_bmap *bmap, __u64 key); | ||
| 160 | void nilfs_bmap_clear(struct nilfs_bmap *); | 163 | void nilfs_bmap_clear(struct nilfs_bmap *); |
| 161 | int nilfs_bmap_propagate(struct nilfs_bmap *, struct buffer_head *); | 164 | int nilfs_bmap_propagate(struct nilfs_bmap *, struct buffer_head *); |
| 162 | void nilfs_bmap_lookup_dirty_buffers(struct nilfs_bmap *, struct list_head *); | 165 | void nilfs_bmap_lookup_dirty_buffers(struct nilfs_bmap *, struct list_head *); |
diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c index ecdbae19a766..059f37137f9a 100644 --- a/fs/nilfs2/btree.c +++ b/fs/nilfs2/btree.c | |||
| @@ -633,6 +633,44 @@ static int nilfs_btree_do_lookup_last(const struct nilfs_bmap *btree, | |||
| 633 | return 0; | 633 | return 0; |
| 634 | } | 634 | } |
| 635 | 635 | ||
| 636 | /** | ||
| 637 | * nilfs_btree_get_next_key - get next valid key from btree path array | ||
| 638 | * @btree: bmap struct of btree | ||
| 639 | * @path: array of nilfs_btree_path struct | ||
| 640 | * @minlevel: start level | ||
| 641 | * @nextkey: place to store the next valid key | ||
| 642 | * | ||
| 643 | * Return Value: If a next key was found, 0 is returned. Otherwise, | ||
| 644 | * -ENOENT is returned. | ||
| 645 | */ | ||
| 646 | static int nilfs_btree_get_next_key(const struct nilfs_bmap *btree, | ||
| 647 | const struct nilfs_btree_path *path, | ||
| 648 | int minlevel, __u64 *nextkey) | ||
| 649 | { | ||
| 650 | struct nilfs_btree_node *node; | ||
| 651 | int maxlevel = nilfs_btree_height(btree) - 1; | ||
| 652 | int index, next_adj, level; | ||
| 653 | |||
| 654 | /* Next index is already set to bp_index for leaf nodes. */ | ||
| 655 | next_adj = 0; | ||
| 656 | for (level = minlevel; level <= maxlevel; level++) { | ||
| 657 | if (level == maxlevel) | ||
| 658 | node = nilfs_btree_get_root(btree); | ||
| 659 | else | ||
| 660 | node = nilfs_btree_get_nonroot_node(path, level); | ||
| 661 | |||
| 662 | index = path[level].bp_index + next_adj; | ||
| 663 | if (index < nilfs_btree_node_get_nchildren(node)) { | ||
| 664 | /* Next key is in this node */ | ||
| 665 | *nextkey = nilfs_btree_node_get_key(node, index); | ||
| 666 | return 0; | ||
| 667 | } | ||
| 668 | /* For non-leaf nodes, next index is stored at bp_index + 1. */ | ||
| 669 | next_adj = 1; | ||
| 670 | } | ||
| 671 | return -ENOENT; | ||
| 672 | } | ||
| 673 | |||
| 636 | static int nilfs_btree_lookup(const struct nilfs_bmap *btree, | 674 | static int nilfs_btree_lookup(const struct nilfs_bmap *btree, |
| 637 | __u64 key, int level, __u64 *ptrp) | 675 | __u64 key, int level, __u64 *ptrp) |
| 638 | { | 676 | { |
| @@ -1563,6 +1601,27 @@ out: | |||
| 1563 | return ret; | 1601 | return ret; |
| 1564 | } | 1602 | } |
| 1565 | 1603 | ||
| 1604 | static int nilfs_btree_seek_key(const struct nilfs_bmap *btree, __u64 start, | ||
| 1605 | __u64 *keyp) | ||
| 1606 | { | ||
| 1607 | struct nilfs_btree_path *path; | ||
| 1608 | const int minlevel = NILFS_BTREE_LEVEL_NODE_MIN; | ||
| 1609 | int ret; | ||
| 1610 | |||
| 1611 | path = nilfs_btree_alloc_path(); | ||
| 1612 | if (!path) | ||
| 1613 | return -ENOMEM; | ||
| 1614 | |||
| 1615 | ret = nilfs_btree_do_lookup(btree, path, start, NULL, minlevel, 0); | ||
| 1616 | if (!ret) | ||
| 1617 | *keyp = start; | ||
| 1618 | else if (ret == -ENOENT) | ||
| 1619 | ret = nilfs_btree_get_next_key(btree, path, minlevel, keyp); | ||
| 1620 | |||
| 1621 | nilfs_btree_free_path(path); | ||
| 1622 | return ret; | ||
| 1623 | } | ||
| 1624 | |||
| 1566 | static int nilfs_btree_last_key(const struct nilfs_bmap *btree, __u64 *keyp) | 1625 | static int nilfs_btree_last_key(const struct nilfs_bmap *btree, __u64 *keyp) |
| 1567 | { | 1626 | { |
| 1568 | struct nilfs_btree_path *path; | 1627 | struct nilfs_btree_path *path; |
| @@ -2298,7 +2357,9 @@ static const struct nilfs_bmap_operations nilfs_btree_ops = { | |||
| 2298 | .bop_assign = nilfs_btree_assign, | 2357 | .bop_assign = nilfs_btree_assign, |
| 2299 | .bop_mark = nilfs_btree_mark, | 2358 | .bop_mark = nilfs_btree_mark, |
| 2300 | 2359 | ||
| 2360 | .bop_seek_key = nilfs_btree_seek_key, | ||
| 2301 | .bop_last_key = nilfs_btree_last_key, | 2361 | .bop_last_key = nilfs_btree_last_key, |
| 2362 | |||
| 2302 | .bop_check_insert = NULL, | 2363 | .bop_check_insert = NULL, |
| 2303 | .bop_check_delete = nilfs_btree_check_delete, | 2364 | .bop_check_delete = nilfs_btree_check_delete, |
| 2304 | .bop_gather_data = nilfs_btree_gather_data, | 2365 | .bop_gather_data = nilfs_btree_gather_data, |
| @@ -2318,7 +2379,9 @@ static const struct nilfs_bmap_operations nilfs_btree_ops_gc = { | |||
| 2318 | .bop_assign = nilfs_btree_assign_gc, | 2379 | .bop_assign = nilfs_btree_assign_gc, |
| 2319 | .bop_mark = NULL, | 2380 | .bop_mark = NULL, |
| 2320 | 2381 | ||
| 2382 | .bop_seek_key = NULL, | ||
| 2321 | .bop_last_key = NULL, | 2383 | .bop_last_key = NULL, |
| 2384 | |||
| 2322 | .bop_check_insert = NULL, | 2385 | .bop_check_insert = NULL, |
| 2323 | .bop_check_delete = NULL, | 2386 | .bop_check_delete = NULL, |
| 2324 | .bop_gather_data = NULL, | 2387 | .bop_gather_data = NULL, |
diff --git a/fs/nilfs2/cpfile.c b/fs/nilfs2/cpfile.c index 0d58075f34e2..b6596cab9e99 100644 --- a/fs/nilfs2/cpfile.c +++ b/fs/nilfs2/cpfile.c | |||
| @@ -53,6 +53,13 @@ nilfs_cpfile_get_offset(const struct inode *cpfile, __u64 cno) | |||
| 53 | return do_div(tcno, nilfs_cpfile_checkpoints_per_block(cpfile)); | 53 | return do_div(tcno, nilfs_cpfile_checkpoints_per_block(cpfile)); |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | static __u64 nilfs_cpfile_first_checkpoint_in_block(const struct inode *cpfile, | ||
| 57 | unsigned long blkoff) | ||
| 58 | { | ||
| 59 | return (__u64)nilfs_cpfile_checkpoints_per_block(cpfile) * blkoff | ||
| 60 | + 1 - NILFS_MDT(cpfile)->mi_first_entry_offset; | ||
| 61 | } | ||
| 62 | |||
| 56 | static unsigned long | 63 | static unsigned long |
| 57 | nilfs_cpfile_checkpoints_in_block(const struct inode *cpfile, | 64 | nilfs_cpfile_checkpoints_in_block(const struct inode *cpfile, |
| 58 | __u64 curr, | 65 | __u64 curr, |
| @@ -146,6 +153,44 @@ static inline int nilfs_cpfile_get_checkpoint_block(struct inode *cpfile, | |||
| 146 | create, nilfs_cpfile_block_init, bhp); | 153 | create, nilfs_cpfile_block_init, bhp); |
| 147 | } | 154 | } |
| 148 | 155 | ||
| 156 | /** | ||
| 157 | * nilfs_cpfile_find_checkpoint_block - find and get a buffer on cpfile | ||
| 158 | * @cpfile: inode of cpfile | ||
| 159 | * @start_cno: start checkpoint number (inclusive) | ||
| 160 | * @end_cno: end checkpoint number (inclusive) | ||
| 161 | * @cnop: place to store the next checkpoint number | ||
| 162 | * @bhp: place to store a pointer to buffer_head struct | ||
| 163 | * | ||
| 164 | * Return Value: On success, it returns 0. On error, the following negative | ||
| 165 | * error code is returned. | ||
| 166 | * | ||
| 167 | * %-ENOMEM - Insufficient memory available. | ||
| 168 | * | ||
| 169 | * %-EIO - I/O error | ||
| 170 | * | ||
| 171 | * %-ENOENT - no block exists in the range. | ||
| 172 | */ | ||
| 173 | static int nilfs_cpfile_find_checkpoint_block(struct inode *cpfile, | ||
| 174 | __u64 start_cno, __u64 end_cno, | ||
| 175 | __u64 *cnop, | ||
| 176 | struct buffer_head **bhp) | ||
| 177 | { | ||
| 178 | unsigned long start, end, blkoff; | ||
| 179 | int ret; | ||
| 180 | |||
| 181 | if (unlikely(start_cno > end_cno)) | ||
| 182 | return -ENOENT; | ||
| 183 | |||
| 184 | start = nilfs_cpfile_get_blkoff(cpfile, start_cno); | ||
| 185 | end = nilfs_cpfile_get_blkoff(cpfile, end_cno); | ||
| 186 | |||
| 187 | ret = nilfs_mdt_find_block(cpfile, start, end, &blkoff, bhp); | ||
| 188 | if (!ret) | ||
| 189 | *cnop = (blkoff == start) ? start_cno : | ||
| 190 | nilfs_cpfile_first_checkpoint_in_block(cpfile, blkoff); | ||
| 191 | return ret; | ||
| 192 | } | ||
| 193 | |||
| 149 | static inline int nilfs_cpfile_delete_checkpoint_block(struct inode *cpfile, | 194 | static inline int nilfs_cpfile_delete_checkpoint_block(struct inode *cpfile, |
| 150 | __u64 cno) | 195 | __u64 cno) |
| 151 | { | 196 | { |
| @@ -403,14 +448,15 @@ static ssize_t nilfs_cpfile_do_get_cpinfo(struct inode *cpfile, __u64 *cnop, | |||
| 403 | return -ENOENT; /* checkpoint number 0 is invalid */ | 448 | return -ENOENT; /* checkpoint number 0 is invalid */ |
| 404 | down_read(&NILFS_MDT(cpfile)->mi_sem); | 449 | down_read(&NILFS_MDT(cpfile)->mi_sem); |
| 405 | 450 | ||
| 406 | for (n = 0; cno < cur_cno && n < nci; cno += ncps) { | 451 | for (n = 0; n < nci; cno += ncps) { |
| 407 | ncps = nilfs_cpfile_checkpoints_in_block(cpfile, cno, cur_cno); | 452 | ret = nilfs_cpfile_find_checkpoint_block( |
| 408 | ret = nilfs_cpfile_get_checkpoint_block(cpfile, cno, 0, &bh); | 453 | cpfile, cno, cur_cno - 1, &cno, &bh); |
| 409 | if (ret < 0) { | 454 | if (ret < 0) { |
| 410 | if (ret != -ENOENT) | 455 | if (likely(ret == -ENOENT)) |
| 411 | goto out; | 456 | break; |
| 412 | continue; /* skip hole */ | 457 | goto out; |
| 413 | } | 458 | } |
| 459 | ncps = nilfs_cpfile_checkpoints_in_block(cpfile, cno, cur_cno); | ||
| 414 | 460 | ||
| 415 | kaddr = kmap_atomic(bh->b_page); | 461 | kaddr = kmap_atomic(bh->b_page); |
| 416 | cp = nilfs_cpfile_block_get_checkpoint(cpfile, cno, bh, kaddr); | 462 | cp = nilfs_cpfile_block_get_checkpoint(cpfile, cno, bh, kaddr); |
diff --git a/fs/nilfs2/direct.c b/fs/nilfs2/direct.c index 82f4865e86dd..ebf89fd8ac1a 100644 --- a/fs/nilfs2/direct.c +++ b/fs/nilfs2/direct.c | |||
| @@ -173,6 +173,21 @@ static int nilfs_direct_delete(struct nilfs_bmap *bmap, __u64 key) | |||
| 173 | return ret; | 173 | return ret; |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | static int nilfs_direct_seek_key(const struct nilfs_bmap *direct, __u64 start, | ||
| 177 | __u64 *keyp) | ||
| 178 | { | ||
| 179 | __u64 key; | ||
| 180 | |||
| 181 | for (key = start; key <= NILFS_DIRECT_KEY_MAX; key++) { | ||
| 182 | if (nilfs_direct_get_ptr(direct, key) != | ||
| 183 | NILFS_BMAP_INVALID_PTR) { | ||
| 184 | *keyp = key; | ||
| 185 | return 0; | ||
| 186 | } | ||
| 187 | } | ||
| 188 | return -ENOENT; | ||
| 189 | } | ||
| 190 | |||
| 176 | static int nilfs_direct_last_key(const struct nilfs_bmap *direct, __u64 *keyp) | 191 | static int nilfs_direct_last_key(const struct nilfs_bmap *direct, __u64 *keyp) |
| 177 | { | 192 | { |
| 178 | __u64 key, lastkey; | 193 | __u64 key, lastkey; |
| @@ -355,7 +370,9 @@ static const struct nilfs_bmap_operations nilfs_direct_ops = { | |||
| 355 | .bop_assign = nilfs_direct_assign, | 370 | .bop_assign = nilfs_direct_assign, |
| 356 | .bop_mark = NULL, | 371 | .bop_mark = NULL, |
| 357 | 372 | ||
| 373 | .bop_seek_key = nilfs_direct_seek_key, | ||
| 358 | .bop_last_key = nilfs_direct_last_key, | 374 | .bop_last_key = nilfs_direct_last_key, |
| 375 | |||
| 359 | .bop_check_insert = nilfs_direct_check_insert, | 376 | .bop_check_insert = nilfs_direct_check_insert, |
| 360 | .bop_check_delete = NULL, | 377 | .bop_check_delete = NULL, |
| 361 | .bop_gather_data = nilfs_direct_gather_data, | 378 | .bop_gather_data = nilfs_direct_gather_data, |
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c index 36f057fa8aa3..be936df4ba73 100644 --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c | |||
| @@ -106,7 +106,7 @@ int nilfs_get_block(struct inode *inode, sector_t blkoff, | |||
| 106 | err = nilfs_transaction_begin(inode->i_sb, &ti, 1); | 106 | err = nilfs_transaction_begin(inode->i_sb, &ti, 1); |
| 107 | if (unlikely(err)) | 107 | if (unlikely(err)) |
| 108 | goto out; | 108 | goto out; |
| 109 | err = nilfs_bmap_insert(ii->i_bmap, (unsigned long)blkoff, | 109 | err = nilfs_bmap_insert(ii->i_bmap, blkoff, |
| 110 | (unsigned long)bh_result); | 110 | (unsigned long)bh_result); |
| 111 | if (unlikely(err != 0)) { | 111 | if (unlikely(err != 0)) { |
| 112 | if (err == -EEXIST) { | 112 | if (err == -EEXIST) { |
| @@ -441,21 +441,20 @@ struct inode *nilfs_new_inode(struct inode *dir, umode_t mode) | |||
| 441 | void nilfs_set_inode_flags(struct inode *inode) | 441 | void nilfs_set_inode_flags(struct inode *inode) |
| 442 | { | 442 | { |
| 443 | unsigned int flags = NILFS_I(inode)->i_flags; | 443 | unsigned int flags = NILFS_I(inode)->i_flags; |
| 444 | unsigned int new_fl = 0; | ||
| 444 | 445 | ||
| 445 | inode->i_flags &= ~(S_SYNC | S_APPEND | S_IMMUTABLE | S_NOATIME | | ||
| 446 | S_DIRSYNC); | ||
| 447 | if (flags & FS_SYNC_FL) | 446 | if (flags & FS_SYNC_FL) |
| 448 | inode->i_flags |= S_SYNC; | 447 | new_fl |= S_SYNC; |
| 449 | if (flags & FS_APPEND_FL) | 448 | if (flags & FS_APPEND_FL) |
| 450 | inode->i_flags |= S_APPEND; | 449 | new_fl |= S_APPEND; |
| 451 | if (flags & FS_IMMUTABLE_FL) | 450 | if (flags & FS_IMMUTABLE_FL) |
| 452 | inode->i_flags |= S_IMMUTABLE; | 451 | new_fl |= S_IMMUTABLE; |
| 453 | if (flags & FS_NOATIME_FL) | 452 | if (flags & FS_NOATIME_FL) |
| 454 | inode->i_flags |= S_NOATIME; | 453 | new_fl |= S_NOATIME; |
| 455 | if (flags & FS_DIRSYNC_FL) | 454 | if (flags & FS_DIRSYNC_FL) |
| 456 | inode->i_flags |= S_DIRSYNC; | 455 | new_fl |= S_DIRSYNC; |
| 457 | mapping_set_gfp_mask(inode->i_mapping, | 456 | inode_set_flags(inode, new_fl, S_SYNC | S_APPEND | S_IMMUTABLE | |
| 458 | mapping_gfp_mask(inode->i_mapping) & ~__GFP_FS); | 457 | S_NOATIME | S_DIRSYNC); |
| 459 | } | 458 | } |
| 460 | 459 | ||
| 461 | int nilfs_read_inode_common(struct inode *inode, | 460 | int nilfs_read_inode_common(struct inode *inode, |
| @@ -540,6 +539,8 @@ static int __nilfs_read_inode(struct super_block *sb, | |||
| 540 | brelse(bh); | 539 | brelse(bh); |
| 541 | up_read(&NILFS_MDT(nilfs->ns_dat)->mi_sem); | 540 | up_read(&NILFS_MDT(nilfs->ns_dat)->mi_sem); |
| 542 | nilfs_set_inode_flags(inode); | 541 | nilfs_set_inode_flags(inode); |
| 542 | mapping_set_gfp_mask(inode->i_mapping, | ||
| 543 | mapping_gfp_mask(inode->i_mapping) & ~__GFP_FS); | ||
| 543 | return 0; | 544 | return 0; |
| 544 | 545 | ||
| 545 | failed_unmap: | 546 | failed_unmap: |
| @@ -712,7 +713,7 @@ void nilfs_update_inode(struct inode *inode, struct buffer_head *ibh, int flags) | |||
| 712 | static void nilfs_truncate_bmap(struct nilfs_inode_info *ii, | 713 | static void nilfs_truncate_bmap(struct nilfs_inode_info *ii, |
| 713 | unsigned long from) | 714 | unsigned long from) |
| 714 | { | 715 | { |
| 715 | unsigned long b; | 716 | __u64 b; |
| 716 | int ret; | 717 | int ret; |
| 717 | 718 | ||
| 718 | if (!test_bit(NILFS_I_BMAP, &ii->i_state)) | 719 | if (!test_bit(NILFS_I_BMAP, &ii->i_state)) |
| @@ -727,7 +728,7 @@ repeat: | |||
| 727 | if (b < from) | 728 | if (b < from) |
| 728 | return; | 729 | return; |
| 729 | 730 | ||
| 730 | b -= min_t(unsigned long, NILFS_MAX_TRUNCATE_BLOCKS, b - from); | 731 | b -= min_t(__u64, NILFS_MAX_TRUNCATE_BLOCKS, b - from); |
| 731 | ret = nilfs_bmap_truncate(ii->i_bmap, b); | 732 | ret = nilfs_bmap_truncate(ii->i_bmap, b); |
| 732 | nilfs_relax_pressure_in_lock(ii->vfs_inode.i_sb); | 733 | nilfs_relax_pressure_in_lock(ii->vfs_inode.i_sb); |
| 733 | if (!ret || (ret == -ENOMEM && | 734 | if (!ret || (ret == -ENOMEM && |
diff --git a/fs/nilfs2/mdt.c b/fs/nilfs2/mdt.c index 892cf5ffdb8e..dee34d990281 100644 --- a/fs/nilfs2/mdt.c +++ b/fs/nilfs2/mdt.c | |||
| @@ -261,6 +261,60 @@ int nilfs_mdt_get_block(struct inode *inode, unsigned long blkoff, int create, | |||
| 261 | } | 261 | } |
| 262 | 262 | ||
| 263 | /** | 263 | /** |
| 264 | * nilfs_mdt_find_block - find and get a buffer on meta data file. | ||
| 265 | * @inode: inode of the meta data file | ||
| 266 | * @start: start block offset (inclusive) | ||
| 267 | * @end: end block offset (inclusive) | ||
| 268 | * @blkoff: block offset | ||
| 269 | * @out_bh: place to store a pointer to buffer_head struct | ||
| 270 | * | ||
| 271 | * nilfs_mdt_find_block() looks up an existing block in range of | ||
| 272 | * [@start, @end] and stores pointer to a buffer head of the block to | ||
| 273 | * @out_bh, and block offset to @blkoff, respectively. @out_bh and | ||
| 274 | * @blkoff are substituted only when zero is returned. | ||
| 275 | * | ||
| 276 | * Return Value: On success, it returns 0. On error, the following negative | ||
| 277 | * error code is returned. | ||
| 278 | * | ||
| 279 | * %-ENOMEM - Insufficient memory available. | ||
| 280 | * | ||
| 281 | * %-EIO - I/O error | ||
| 282 | * | ||
| 283 | * %-ENOENT - no block was found in the range | ||
| 284 | */ | ||
| 285 | int nilfs_mdt_find_block(struct inode *inode, unsigned long start, | ||
| 286 | unsigned long end, unsigned long *blkoff, | ||
| 287 | struct buffer_head **out_bh) | ||
| 288 | { | ||
| 289 | __u64 next; | ||
| 290 | int ret; | ||
| 291 | |||
| 292 | if (unlikely(start > end)) | ||
| 293 | return -ENOENT; | ||
| 294 | |||
| 295 | ret = nilfs_mdt_read_block(inode, start, true, out_bh); | ||
| 296 | if (!ret) { | ||
| 297 | *blkoff = start; | ||
| 298 | goto out; | ||
| 299 | } | ||
| 300 | if (unlikely(ret != -ENOENT || start == ULONG_MAX)) | ||
| 301 | goto out; | ||
| 302 | |||
| 303 | ret = nilfs_bmap_seek_key(NILFS_I(inode)->i_bmap, start + 1, &next); | ||
| 304 | if (!ret) { | ||
| 305 | if (next <= end) { | ||
| 306 | ret = nilfs_mdt_read_block(inode, next, true, out_bh); | ||
| 307 | if (!ret) | ||
| 308 | *blkoff = next; | ||
| 309 | } else { | ||
| 310 | ret = -ENOENT; | ||
| 311 | } | ||
| 312 | } | ||
| 313 | out: | ||
| 314 | return ret; | ||
| 315 | } | ||
| 316 | |||
| 317 | /** | ||
| 264 | * nilfs_mdt_delete_block - make a hole on the meta data file. | 318 | * nilfs_mdt_delete_block - make a hole on the meta data file. |
| 265 | * @inode: inode of the meta data file | 319 | * @inode: inode of the meta data file |
| 266 | * @block: block offset | 320 | * @block: block offset |
diff --git a/fs/nilfs2/mdt.h b/fs/nilfs2/mdt.h index ab172e8549c5..fe529a87a208 100644 --- a/fs/nilfs2/mdt.h +++ b/fs/nilfs2/mdt.h | |||
| @@ -78,6 +78,9 @@ int nilfs_mdt_get_block(struct inode *, unsigned long, int, | |||
| 78 | void (*init_block)(struct inode *, | 78 | void (*init_block)(struct inode *, |
| 79 | struct buffer_head *, void *), | 79 | struct buffer_head *, void *), |
| 80 | struct buffer_head **); | 80 | struct buffer_head **); |
| 81 | int nilfs_mdt_find_block(struct inode *inode, unsigned long start, | ||
| 82 | unsigned long end, unsigned long *blkoff, | ||
| 83 | struct buffer_head **out_bh); | ||
| 81 | int nilfs_mdt_delete_block(struct inode *, unsigned long); | 84 | int nilfs_mdt_delete_block(struct inode *, unsigned long); |
| 82 | int nilfs_mdt_forget_block(struct inode *, unsigned long); | 85 | int nilfs_mdt_forget_block(struct inode *, unsigned long); |
| 83 | int nilfs_mdt_mark_block_dirty(struct inode *, unsigned long); | 86 | int nilfs_mdt_mark_block_dirty(struct inode *, unsigned long); |
| @@ -111,7 +114,10 @@ static inline __u64 nilfs_mdt_cno(struct inode *inode) | |||
| 111 | return ((struct the_nilfs *)inode->i_sb->s_fs_info)->ns_cno; | 114 | return ((struct the_nilfs *)inode->i_sb->s_fs_info)->ns_cno; |
| 112 | } | 115 | } |
| 113 | 116 | ||
| 114 | #define nilfs_mdt_bgl_lock(inode, bg) \ | 117 | static inline spinlock_t * |
| 115 | (&NILFS_MDT(inode)->mi_bgl->locks[(bg) & (NR_BG_LOCKS-1)].lock) | 118 | nilfs_mdt_bgl_lock(struct inode *inode, unsigned int block_group) |
| 119 | { | ||
| 120 | return bgl_lock_ptr(NILFS_MDT(inode)->mi_bgl, block_group); | ||
| 121 | } | ||
| 116 | 122 | ||
| 117 | #endif /* _NILFS_MDT_H */ | 123 | #endif /* _NILFS_MDT_H */ |
diff --git a/fs/nilfs2/page.c b/fs/nilfs2/page.c index 700ecbcca55d..45d650addd56 100644 --- a/fs/nilfs2/page.c +++ b/fs/nilfs2/page.c | |||
| @@ -89,18 +89,16 @@ struct buffer_head *nilfs_grab_buffer(struct inode *inode, | |||
| 89 | void nilfs_forget_buffer(struct buffer_head *bh) | 89 | void nilfs_forget_buffer(struct buffer_head *bh) |
| 90 | { | 90 | { |
| 91 | struct page *page = bh->b_page; | 91 | struct page *page = bh->b_page; |
| 92 | const unsigned long clear_bits = | ||
| 93 | (1 << BH_Uptodate | 1 << BH_Dirty | 1 << BH_Mapped | | ||
| 94 | 1 << BH_Async_Write | 1 << BH_NILFS_Volatile | | ||
| 95 | 1 << BH_NILFS_Checked | 1 << BH_NILFS_Redirected); | ||
| 92 | 96 | ||
| 93 | lock_buffer(bh); | 97 | lock_buffer(bh); |
| 94 | clear_buffer_nilfs_volatile(bh); | 98 | set_mask_bits(&bh->b_state, clear_bits, 0); |
| 95 | clear_buffer_nilfs_checked(bh); | ||
| 96 | clear_buffer_nilfs_redirected(bh); | ||
| 97 | clear_buffer_async_write(bh); | ||
| 98 | clear_buffer_dirty(bh); | ||
| 99 | if (nilfs_page_buffers_clean(page)) | 99 | if (nilfs_page_buffers_clean(page)) |
| 100 | __nilfs_clear_page_dirty(page); | 100 | __nilfs_clear_page_dirty(page); |
| 101 | 101 | ||
| 102 | clear_buffer_uptodate(bh); | ||
| 103 | clear_buffer_mapped(bh); | ||
| 104 | bh->b_blocknr = -1; | 102 | bh->b_blocknr = -1; |
| 105 | ClearPageUptodate(page); | 103 | ClearPageUptodate(page); |
| 106 | ClearPageMappedToDisk(page); | 104 | ClearPageMappedToDisk(page); |
| @@ -421,6 +419,10 @@ void nilfs_clear_dirty_page(struct page *page, bool silent) | |||
| 421 | 419 | ||
| 422 | if (page_has_buffers(page)) { | 420 | if (page_has_buffers(page)) { |
| 423 | struct buffer_head *bh, *head; | 421 | struct buffer_head *bh, *head; |
| 422 | const unsigned long clear_bits = | ||
| 423 | (1 << BH_Uptodate | 1 << BH_Dirty | 1 << BH_Mapped | | ||
| 424 | 1 << BH_Async_Write | 1 << BH_NILFS_Volatile | | ||
| 425 | 1 << BH_NILFS_Checked | 1 << BH_NILFS_Redirected); | ||
| 424 | 426 | ||
| 425 | bh = head = page_buffers(page); | 427 | bh = head = page_buffers(page); |
| 426 | do { | 428 | do { |
| @@ -430,13 +432,7 @@ void nilfs_clear_dirty_page(struct page *page, bool silent) | |||
| 430 | "discard block %llu, size %zu", | 432 | "discard block %llu, size %zu", |
| 431 | (u64)bh->b_blocknr, bh->b_size); | 433 | (u64)bh->b_blocknr, bh->b_size); |
| 432 | } | 434 | } |
| 433 | clear_buffer_async_write(bh); | 435 | set_mask_bits(&bh->b_state, clear_bits, 0); |
| 434 | clear_buffer_dirty(bh); | ||
| 435 | clear_buffer_nilfs_volatile(bh); | ||
| 436 | clear_buffer_nilfs_checked(bh); | ||
| 437 | clear_buffer_nilfs_redirected(bh); | ||
| 438 | clear_buffer_uptodate(bh); | ||
| 439 | clear_buffer_mapped(bh); | ||
| 440 | unlock_buffer(bh); | 436 | unlock_buffer(bh); |
| 441 | } while (bh = bh->b_this_page, bh != head); | 437 | } while (bh = bh->b_this_page, bh != head); |
| 442 | } | 438 | } |
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c index 0c3f303baf32..c6abbad9b8e3 100644 --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #include <linux/pagemap.h> | 24 | #include <linux/pagemap.h> |
| 25 | #include <linux/buffer_head.h> | 25 | #include <linux/buffer_head.h> |
| 26 | #include <linux/writeback.h> | 26 | #include <linux/writeback.h> |
| 27 | #include <linux/bitops.h> | ||
| 27 | #include <linux/bio.h> | 28 | #include <linux/bio.h> |
| 28 | #include <linux/completion.h> | 29 | #include <linux/completion.h> |
| 29 | #include <linux/blkdev.h> | 30 | #include <linux/blkdev.h> |
| @@ -1588,7 +1589,6 @@ static void nilfs_segctor_prepare_write(struct nilfs_sc_info *sci) | |||
| 1588 | 1589 | ||
| 1589 | list_for_each_entry(bh, &segbuf->sb_segsum_buffers, | 1590 | list_for_each_entry(bh, &segbuf->sb_segsum_buffers, |
| 1590 | b_assoc_buffers) { | 1591 | b_assoc_buffers) { |
| 1591 | set_buffer_async_write(bh); | ||
| 1592 | if (bh->b_page != bd_page) { | 1592 | if (bh->b_page != bd_page) { |
| 1593 | if (bd_page) { | 1593 | if (bd_page) { |
| 1594 | lock_page(bd_page); | 1594 | lock_page(bd_page); |
| @@ -1688,7 +1688,6 @@ static void nilfs_abort_logs(struct list_head *logs, int err) | |||
| 1688 | list_for_each_entry(segbuf, logs, sb_list) { | 1688 | list_for_each_entry(segbuf, logs, sb_list) { |
| 1689 | list_for_each_entry(bh, &segbuf->sb_segsum_buffers, | 1689 | list_for_each_entry(bh, &segbuf->sb_segsum_buffers, |
| 1690 | b_assoc_buffers) { | 1690 | b_assoc_buffers) { |
| 1691 | clear_buffer_async_write(bh); | ||
| 1692 | if (bh->b_page != bd_page) { | 1691 | if (bh->b_page != bd_page) { |
| 1693 | if (bd_page) | 1692 | if (bd_page) |
| 1694 | end_page_writeback(bd_page); | 1693 | end_page_writeback(bd_page); |
| @@ -1768,7 +1767,6 @@ static void nilfs_segctor_complete_write(struct nilfs_sc_info *sci) | |||
| 1768 | b_assoc_buffers) { | 1767 | b_assoc_buffers) { |
| 1769 | set_buffer_uptodate(bh); | 1768 | set_buffer_uptodate(bh); |
| 1770 | clear_buffer_dirty(bh); | 1769 | clear_buffer_dirty(bh); |
| 1771 | clear_buffer_async_write(bh); | ||
| 1772 | if (bh->b_page != bd_page) { | 1770 | if (bh->b_page != bd_page) { |
| 1773 | if (bd_page) | 1771 | if (bd_page) |
| 1774 | end_page_writeback(bd_page); | 1772 | end_page_writeback(bd_page); |
| @@ -1788,12 +1786,13 @@ static void nilfs_segctor_complete_write(struct nilfs_sc_info *sci) | |||
| 1788 | */ | 1786 | */ |
| 1789 | list_for_each_entry(bh, &segbuf->sb_payload_buffers, | 1787 | list_for_each_entry(bh, &segbuf->sb_payload_buffers, |
| 1790 | b_assoc_buffers) { | 1788 | b_assoc_buffers) { |
| 1791 | set_buffer_uptodate(bh); | 1789 | const unsigned long set_bits = (1 << BH_Uptodate); |
| 1792 | clear_buffer_dirty(bh); | 1790 | const unsigned long clear_bits = |
| 1793 | clear_buffer_async_write(bh); | 1791 | (1 << BH_Dirty | 1 << BH_Async_Write | |
| 1794 | clear_buffer_delay(bh); | 1792 | 1 << BH_Delay | 1 << BH_NILFS_Volatile | |
| 1795 | clear_buffer_nilfs_volatile(bh); | 1793 | 1 << BH_NILFS_Redirected); |
| 1796 | clear_buffer_nilfs_redirected(bh); | 1794 | |
| 1795 | set_mask_bits(&bh->b_state, clear_bits, set_bits); | ||
| 1797 | if (bh == segbuf->sb_super_root) { | 1796 | if (bh == segbuf->sb_super_root) { |
| 1798 | if (bh->b_page != bd_page) { | 1797 | if (bh->b_page != bd_page) { |
| 1799 | end_page_writeback(bd_page); | 1798 | end_page_writeback(bd_page); |
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index 5bc2a1cf73c3..c1725f20a9d1 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c | |||
| @@ -1020,7 +1020,7 @@ int nilfs_checkpoint_is_mounted(struct super_block *sb, __u64 cno) | |||
| 1020 | struct dentry *dentry; | 1020 | struct dentry *dentry; |
| 1021 | int ret; | 1021 | int ret; |
| 1022 | 1022 | ||
| 1023 | if (cno < 0 || cno > nilfs->ns_cno) | 1023 | if (cno > nilfs->ns_cno) |
| 1024 | return false; | 1024 | return false; |
| 1025 | 1025 | ||
| 1026 | if (cno >= nilfs_last_cno(nilfs)) | 1026 | if (cno >= nilfs_last_cno(nilfs)) |
diff --git a/fs/proc/fd.c b/fs/proc/fd.c index 8e5ad83b629a..af84ad04df77 100644 --- a/fs/proc/fd.c +++ b/fs/proc/fd.c | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include <linux/security.h> | 8 | #include <linux/security.h> |
| 9 | #include <linux/file.h> | 9 | #include <linux/file.h> |
| 10 | #include <linux/seq_file.h> | 10 | #include <linux/seq_file.h> |
| 11 | #include <linux/fs.h> | ||
| 11 | 12 | ||
| 12 | #include <linux/proc_fs.h> | 13 | #include <linux/proc_fs.h> |
| 13 | 14 | ||
| @@ -48,17 +49,23 @@ static int seq_show(struct seq_file *m, void *v) | |||
| 48 | put_files_struct(files); | 49 | put_files_struct(files); |
| 49 | } | 50 | } |
| 50 | 51 | ||
| 51 | if (!ret) { | 52 | if (ret) |
| 52 | seq_printf(m, "pos:\t%lli\nflags:\t0%o\nmnt_id:\t%i\n", | 53 | return ret; |
| 53 | (long long)file->f_pos, f_flags, | ||
| 54 | real_mount(file->f_path.mnt)->mnt_id); | ||
| 55 | if (file->f_op->show_fdinfo) | ||
| 56 | file->f_op->show_fdinfo(m, file); | ||
| 57 | ret = seq_has_overflowed(m); | ||
| 58 | fput(file); | ||
| 59 | } | ||
| 60 | 54 | ||
| 61 | return ret; | 55 | seq_printf(m, "pos:\t%lli\nflags:\t0%o\nmnt_id:\t%i\n", |
| 56 | (long long)file->f_pos, f_flags, | ||
| 57 | real_mount(file->f_path.mnt)->mnt_id); | ||
| 58 | |||
| 59 | show_fd_locks(m, file, files); | ||
| 60 | if (seq_has_overflowed(m)) | ||
| 61 | goto out; | ||
| 62 | |||
| 63 | if (file->f_op->show_fdinfo) | ||
| 64 | file->f_op->show_fdinfo(m, file); | ||
| 65 | |||
| 66 | out: | ||
| 67 | fput(file); | ||
| 68 | return 0; | ||
| 62 | } | 69 | } |
| 63 | 70 | ||
| 64 | static int seq_fdinfo_open(struct inode *inode, struct file *file) | 71 | static int seq_fdinfo_open(struct inode *inode, struct file *file) |
