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

Configure Feed

Select the types of activity you want to include in your feed.

hpfs: implement the show_options method

The HPFS filesystem used generic_show_options to produce string that is
displayed in /proc/mounts. However, there is a problem that the options
may disappear after remount. If we mount the filesystem with option1
and then remount it with option2, /proc/mounts should show both option1
and option2, however it only shows option2 because the whole option
string is replaced with replace_mount_options in hpfs_remount_fs.

To fix this bug, implement the hpfs_show_options function that prints
options that are currently selected.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Mikulas Patocka and committed by
Linus Torvalds
037369b8 01d6e087

+32 -11
+32 -11
fs/hpfs/super.c
··· 15 15 #include <linux/sched.h> 16 16 #include <linux/bitmap.h> 17 17 #include <linux/slab.h> 18 + #include <linux/seq_file.h> 18 19 19 20 /* Mark the filesystem dirty, so that chkdsk checks it when os/2 booted */ 20 21 ··· 454 453 int lowercase, eas, chk, errs, chkdsk, timeshift; 455 454 int o; 456 455 struct hpfs_sb_info *sbi = hpfs_sb(s); 457 - char *new_opts = kstrdup(data, GFP_KERNEL); 458 - 459 - if (data && !new_opts) 460 - return -ENOMEM; 461 456 462 457 sync_filesystem(s); 463 458 ··· 490 493 491 494 if (!(*flags & MS_RDONLY)) mark_dirty(s, 1); 492 495 493 - if (new_opts) 494 - replace_mount_options(s, new_opts); 495 - 496 496 hpfs_unlock(s); 497 497 return 0; 498 498 499 499 out_err: 500 500 hpfs_unlock(s); 501 - kfree(new_opts); 502 501 return -EINVAL; 502 + } 503 + 504 + static int hpfs_show_options(struct seq_file *seq, struct dentry *root) 505 + { 506 + struct hpfs_sb_info *sbi = hpfs_sb(root->d_sb); 507 + 508 + seq_printf(seq, ",uid=%u", from_kuid_munged(&init_user_ns, sbi->sb_uid)); 509 + seq_printf(seq, ",gid=%u", from_kgid_munged(&init_user_ns, sbi->sb_gid)); 510 + seq_printf(seq, ",umask=%03o", (~sbi->sb_mode & 0777)); 511 + if (sbi->sb_lowercase) 512 + seq_printf(seq, ",case=lower"); 513 + if (!sbi->sb_chk) 514 + seq_printf(seq, ",check=none"); 515 + if (sbi->sb_chk == 2) 516 + seq_printf(seq, ",check=strict"); 517 + if (!sbi->sb_err) 518 + seq_printf(seq, ",errors=continue"); 519 + if (sbi->sb_err == 2) 520 + seq_printf(seq, ",errors=panic"); 521 + if (!sbi->sb_chkdsk) 522 + seq_printf(seq, ",chkdsk=no"); 523 + if (sbi->sb_chkdsk == 2) 524 + seq_printf(seq, ",chkdsk=always"); 525 + if (!sbi->sb_eas) 526 + seq_printf(seq, ",eas=no"); 527 + if (sbi->sb_eas == 1) 528 + seq_printf(seq, ",eas=ro"); 529 + if (sbi->sb_timeshift) 530 + seq_printf(seq, ",timeshift=%d", sbi->sb_timeshift); 531 + return 0; 503 532 } 504 533 505 534 /* Super operations */ ··· 538 515 .put_super = hpfs_put_super, 539 516 .statfs = hpfs_statfs, 540 517 .remount_fs = hpfs_remount_fs, 541 - .show_options = generic_show_options, 518 + .show_options = hpfs_show_options, 542 519 }; 543 520 544 521 static int hpfs_fill_super(struct super_block *s, void *options, int silent) ··· 560 537 struct quad_buffer_head qbh; 561 538 562 539 int o; 563 - 564 - save_mount_options(s, options); 565 540 566 541 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); 567 542 if (!sbi) {