Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull vfs fixes from Al Viro.

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
vfs: add missing check for __O_TMPFILE in fcntl_init()
fs: Allow unprivileged linkat(..., AT_EMPTY_PATH) aka flink
fs: Fix file mode for O_TMPFILE
reiserfs: fix deadlock in umount

+26 -92
+2 -2
fs/fcntl.c
··· 730 730 * Exceptions: O_NONBLOCK is a two bit define on parisc; O_NDELAY 731 731 * is defined as O_NONBLOCK on some platforms and not on others. 732 732 */ 733 - BUILD_BUG_ON(19 - 1 /* for O_RDONLY being 0 */ != HWEIGHT32( 733 + BUILD_BUG_ON(20 - 1 /* for O_RDONLY being 0 */ != HWEIGHT32( 734 734 O_RDONLY | O_WRONLY | O_RDWR | 735 735 O_CREAT | O_EXCL | O_NOCTTY | 736 736 O_TRUNC | O_APPEND | /* O_NONBLOCK | */ 737 737 __O_SYNC | O_DSYNC | FASYNC | 738 738 O_DIRECT | O_LARGEFILE | O_DIRECTORY | 739 739 O_NOFOLLOW | O_NOATIME | O_CLOEXEC | 740 - __FMODE_EXEC | O_PATH 740 + __FMODE_EXEC | O_PATH | __O_TMPFILE 741 741 )); 742 742 743 743 fasync_cache = kmem_cache_create("fasync_cache",
+3 -7
fs/namei.c
··· 3671 3671 if ((flags & ~(AT_SYMLINK_FOLLOW | AT_EMPTY_PATH)) != 0) 3672 3672 return -EINVAL; 3673 3673 /* 3674 - * To use null names we require CAP_DAC_READ_SEARCH 3675 - * This ensures that not everyone will be able to create 3676 - * handlink using the passed filedescriptor. 3674 + * Using empty names is equivalent to using AT_SYMLINK_FOLLOW 3675 + * on /proc/self/fd/<fd>. 3677 3676 */ 3678 - if (flags & AT_EMPTY_PATH) { 3679 - if (!capable(CAP_DAC_READ_SEARCH)) 3680 - return -ENOENT; 3677 + if (flags & AT_EMPTY_PATH) 3681 3678 how = LOOKUP_EMPTY; 3682 - } 3683 3679 3684 3680 if (flags & AT_SYMLINK_FOLLOW) 3685 3681 how |= LOOKUP_FOLLOW;
+1 -1
fs/open.c
··· 823 823 int lookup_flags = 0; 824 824 int acc_mode; 825 825 826 - if (flags & O_CREAT) 826 + if (flags & (O_CREAT | __O_TMPFILE)) 827 827 op->mode = (mode & S_IALLUGO) | S_IFREG; 828 828 else 829 829 op->mode = 0;
+19 -80
fs/reiserfs/procfs.c
··· 19 19 /* 20 20 * LOCKING: 21 21 * 22 - * We rely on new Alexander Viro's super-block locking. 22 + * These guys are evicted from procfs as the very first step in ->kill_sb(). 23 23 * 24 24 */ 25 25 26 - static int show_version(struct seq_file *m, struct super_block *sb) 26 + static int show_version(struct seq_file *m, void *unused) 27 27 { 28 + struct super_block *sb = m->private; 28 29 char *format; 29 30 30 31 if (REISERFS_SB(sb)->s_properties & (1 << REISERFS_3_6)) { ··· 67 66 #define DJP( x ) le32_to_cpu( jp -> x ) 68 67 #define JF( x ) ( r -> s_journal -> x ) 69 68 70 - static int show_super(struct seq_file *m, struct super_block *sb) 69 + static int show_super(struct seq_file *m, void *unused) 71 70 { 71 + struct super_block *sb = m->private; 72 72 struct reiserfs_sb_info *r = REISERFS_SB(sb); 73 73 74 74 seq_printf(m, "state: \t%s\n" ··· 130 128 return 0; 131 129 } 132 130 133 - static int show_per_level(struct seq_file *m, struct super_block *sb) 131 + static int show_per_level(struct seq_file *m, void *unused) 134 132 { 133 + struct super_block *sb = m->private; 135 134 struct reiserfs_sb_info *r = REISERFS_SB(sb); 136 135 int level; 137 136 ··· 189 186 return 0; 190 187 } 191 188 192 - static int show_bitmap(struct seq_file *m, struct super_block *sb) 189 + static int show_bitmap(struct seq_file *m, void *unused) 193 190 { 191 + struct super_block *sb = m->private; 194 192 struct reiserfs_sb_info *r = REISERFS_SB(sb); 195 193 196 194 seq_printf(m, "free_block: %lu\n" ··· 222 218 return 0; 223 219 } 224 220 225 - static int show_on_disk_super(struct seq_file *m, struct super_block *sb) 221 + static int show_on_disk_super(struct seq_file *m, void *unused) 226 222 { 223 + struct super_block *sb = m->private; 227 224 struct reiserfs_sb_info *sb_info = REISERFS_SB(sb); 228 225 struct reiserfs_super_block *rs = sb_info->s_rs; 229 226 int hash_code = DFL(s_hash_function_code); ··· 266 261 return 0; 267 262 } 268 263 269 - static int show_oidmap(struct seq_file *m, struct super_block *sb) 264 + static int show_oidmap(struct seq_file *m, void *unused) 270 265 { 266 + struct super_block *sb = m->private; 271 267 struct reiserfs_sb_info *sb_info = REISERFS_SB(sb); 272 268 struct reiserfs_super_block *rs = sb_info->s_rs; 273 269 unsigned int mapsize = le16_to_cpu(rs->s_v1.s_oid_cursize); ··· 297 291 return 0; 298 292 } 299 293 300 - static int show_journal(struct seq_file *m, struct super_block *sb) 294 + static int show_journal(struct seq_file *m, void *unused) 301 295 { 296 + struct super_block *sb = m->private; 302 297 struct reiserfs_sb_info *r = REISERFS_SB(sb); 303 298 struct reiserfs_super_block *rs = r->s_rs; 304 299 struct journal_params *jp = &rs->s_v1.s_journal; ··· 390 383 return 0; 391 384 } 392 385 393 - /* iterator */ 394 - static int test_sb(struct super_block *sb, void *data) 395 - { 396 - return data == sb; 397 - } 398 - 399 - static int set_sb(struct super_block *sb, void *data) 400 - { 401 - return -ENOENT; 402 - } 403 - 404 - struct reiserfs_seq_private { 405 - struct super_block *sb; 406 - int (*show) (struct seq_file *, struct super_block *); 407 - }; 408 - 409 - static void *r_start(struct seq_file *m, loff_t * pos) 410 - { 411 - struct reiserfs_seq_private *priv = m->private; 412 - loff_t l = *pos; 413 - 414 - if (l) 415 - return NULL; 416 - 417 - if (IS_ERR(sget(&reiserfs_fs_type, test_sb, set_sb, 0, priv->sb))) 418 - return NULL; 419 - 420 - up_write(&priv->sb->s_umount); 421 - return priv->sb; 422 - } 423 - 424 - static void *r_next(struct seq_file *m, void *v, loff_t * pos) 425 - { 426 - ++*pos; 427 - if (v) 428 - deactivate_super(v); 429 - return NULL; 430 - } 431 - 432 - static void r_stop(struct seq_file *m, void *v) 433 - { 434 - if (v) 435 - deactivate_super(v); 436 - } 437 - 438 - static int r_show(struct seq_file *m, void *v) 439 - { 440 - struct reiserfs_seq_private *priv = m->private; 441 - return priv->show(m, v); 442 - } 443 - 444 - static const struct seq_operations r_ops = { 445 - .start = r_start, 446 - .next = r_next, 447 - .stop = r_stop, 448 - .show = r_show, 449 - }; 450 - 451 386 static int r_open(struct inode *inode, struct file *file) 452 387 { 453 - struct reiserfs_seq_private *priv; 454 - int ret = seq_open_private(file, &r_ops, 455 - sizeof(struct reiserfs_seq_private)); 456 - 457 - if (!ret) { 458 - struct seq_file *m = file->private_data; 459 - priv = m->private; 460 - priv->sb = proc_get_parent_data(inode); 461 - priv->show = PDE_DATA(inode); 462 - } 463 - return ret; 388 + return single_open(file, PDE_DATA(inode), 389 + proc_get_parent_data(inode)); 464 390 } 465 391 466 392 static const struct file_operations r_file_operations = { 467 393 .open = r_open, 468 394 .read = seq_read, 469 395 .llseek = seq_lseek, 470 - .release = seq_release_private, 471 - .owner = THIS_MODULE, 396 + .release = single_release, 472 397 }; 473 398 474 399 static struct proc_dir_entry *proc_info_root = NULL; 475 400 static const char proc_info_root_name[] = "fs/reiserfs"; 476 401 477 402 static void add_file(struct super_block *sb, char *name, 478 - int (*func) (struct seq_file *, struct super_block *)) 403 + int (*func) (struct seq_file *, void *)) 479 404 { 480 405 proc_create_data(name, 0, REISERFS_SB(sb)->procdir, 481 406 &r_file_operations, func);
+1 -2
fs/reiserfs/super.c
··· 499 499 static void reiserfs_kill_sb(struct super_block *s) 500 500 { 501 501 if (REISERFS_SB(s)) { 502 + reiserfs_proc_info_done(s); 502 503 /* 503 504 * Force any pending inode evictions to occur now. Any 504 505 * inodes to be removed that have extended attributes ··· 554 553 reiserfs_warning(s, "green-2005", "reserved blocks left %d", 555 554 REISERFS_SB(s)->reserved_blocks); 556 555 } 557 - 558 - reiserfs_proc_info_done(s); 559 556 560 557 reiserfs_write_unlock(s); 561 558 mutex_destroy(&REISERFS_SB(s)->lock);