aboutsummaryrefslogtreecommitdiffstats
path: root/fs/affs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-04-17 09:04:38 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-04-17 09:04:38 -0400
commit54e514b91b95d6441c12a7955addfb9f9d2afc65 (patch)
tree8b73d901bd2a6ec5a31f34a8954e5ea92216dd6c /fs/affs
parent4fc8adcfec3da639da76e8314c9ccefe5bf9a045 (diff)
parent6c8c90319c0bb1c9e0b68e721359b89ae4f28465 (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/affs')
-rw-r--r--fs/affs/affs.h28
-rw-r--r--fs/affs/amigaffs.c3
-rw-r--r--fs/affs/file.c2
-rw-r--r--fs/affs/inode.c32
-rw-r--r--fs/affs/namei.c6
-rw-r--r--fs/affs/super.c43
6 files changed, 65 insertions, 49 deletions
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 */
123static inline struct affs_sb_info *AFFS_SB(struct super_block *sb) 127static 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
472affs_nofilenametruncate(const struct dentry *dentry) 472affs_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)
53static inline toupper_t 53static inline toupper_t
54affs_get_toupper(struct super_block *sb) 54affs_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);