Skip to content
Snippets Groups Projects
  1. Oct 31, 2018
  2. Aug 22, 2018
  3. Apr 02, 2018
  4. Nov 16, 2017
  5. Jul 17, 2017
    • David Howells's avatar
      VFS: Differentiate mount flags (MS_*) from internal superblock flags · e462ec50
      David Howells authored
      
      Differentiate the MS_* flags passed to mount(2) from the internal flags set
      in the super_block's s_flags.  s_flags are now called SB_*, with the names
      and the values for the moment mirroring the MS_* flags that they're
      equivalent to.
      
      In this patch, just the headers are altered and some kernel code where
      blind automated conversion isn't necessarily correct.
      
      Note that this shows up some interesting issues:
      
       (1) Some MS_* flags get translated to MNT_* flags (such as MS_NODEV ->
           MNT_NODEV) without passing this on to the filesystem, but some
           filesystems set such flags anyway.
      
       (2) The ->remount_fs() methods of some filesystems adjust the *flags
           argument by setting MS_* flags in it, such as MS_NOATIME - but these
           flags are then scrubbed by do_remount_sb() (only the occupants of
           MS_RMT_MASK are permitted: MS_RDONLY, MS_SYNCHRONOUS, MS_MANDLOCK,
           MS_I_VERSION and MS_LAZYTIME)
      
      I'm not sure what's the best way to solve all these cases.
      
      Suggested-by: default avatarAl Viro <viro@ZenIV.linux.org.uk>
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      e462ec50
    • David Howells's avatar
      VFS: Convert sb->s_flags & MS_RDONLY to sb_rdonly(sb) · bc98a42c
      David Howells authored
      
      Firstly by applying the following with coccinelle's spatch:
      
      	@@ expression SB; @@
      	-SB->s_flags & MS_RDONLY
      	+sb_rdonly(SB)
      
      to effect the conversion to sb_rdonly(sb), then by applying:
      
      	@@ expression A, SB; @@
      	(
      	-(!sb_rdonly(SB)) && A
      	+!sb_rdonly(SB) && A
      	|
      	-A != (sb_rdonly(SB))
      	+A != sb_rdonly(SB)
      	|
      	-A == (sb_rdonly(SB))
      	+A == sb_rdonly(SB)
      	|
      	-!(sb_rdonly(SB))
      	+!sb_rdonly(SB)
      	|
      	-A && (sb_rdonly(SB))
      	+A && sb_rdonly(SB)
      	|
      	-A || (sb_rdonly(SB))
      	+A || sb_rdonly(SB)
      	|
      	-(sb_rdonly(SB)) != A
      	+sb_rdonly(SB) != A
      	|
      	-(sb_rdonly(SB)) == A
      	+sb_rdonly(SB) == A
      	|
      	-(sb_rdonly(SB)) && A
      	+sb_rdonly(SB) && A
      	|
      	-(sb_rdonly(SB)) || A
      	+sb_rdonly(SB) || A
      	)
      
      	@@ expression A, B, SB; @@
      	(
      	-(sb_rdonly(SB)) ? 1 : 0
      	+sb_rdonly(SB)
      	|
      	-(sb_rdonly(SB)) ? A : B
      	+sb_rdonly(SB) ? A : B
      	)
      
      to remove left over excess bracketage and finally by applying:
      
      	@@ expression A, SB; @@
      	(
      	-(A & MS_RDONLY) != sb_rdonly(SB)
      	+(bool)(A & MS_RDONLY) != sb_rdonly(SB)
      	|
      	-(A & MS_RDONLY) == sb_rdonly(SB)
      	+(bool)(A & MS_RDONLY) == sb_rdonly(SB)
      	)
      
      to make comparisons against the result of sb_rdonly() (which is a bool)
      work correctly.
      
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      bc98a42c
  6. Dec 13, 2016
  7. Jun 26, 2015
  8. May 05, 2015
  9. Apr 15, 2015
  10. Dec 17, 2014
    • Miklos Szeredi's avatar
      init: fix read-write root mount · 10975933
      Miklos Szeredi authored
      
      If mount flags don't have MS_RDONLY, iso9660 returns EACCES without actually
      checking if it's an iso image.
      
      This tricks mount_block_root() into retrying with MS_RDONLY.  This results
      in a read-only root despite the "rw" boot parameter if the actual
      filesystem was checked after iso9660.
      
      I believe the behavior of iso9660 is okay, while that of mount_block_root()
      is not.  It should rather try all types without MS_RDONLY and only then
      retry with MS_RDONLY.
      
      This change also makes the code more robust against the case when EACCES is
      returned despite MS_RDONLY, which would've resulted in a lockup.
      
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      10975933
  11. Sep 17, 2014
    • Paul Gortmaker's avatar
      Revert "init: make rootdelay=N consistent with rootwait behaviour" · 8ba4caf1
      Paul Gortmaker authored
      
      This reverts commit 4dfe694f.
      
      In that, we did:
      
        Here we move the rootdelay code to be right beside the rootwait code, so
        that their behaviour is consistent.
      
      ...which is fine, but in hindsight, perhaps moving the rootwait to be
      beside the rootdelay would have been better.  We also indicated:
      
        It should be noted that in doing so, the actions based on the
        saved_root_name[0] and initrd_load() were previously put on hold by
        rootdelay=N and now currently will not be delayed.  However, I think
        consistent behaviour is more important than matching historical behaviour
        of delaying the above two operations.
      
      But Pavel reported an instance where an ARM target with root on MMC
      was failing to mount root, and Russell diagnosed it to the fact that
      the call to set ROOT_DEV within the saved_root_name[0] processing
      block mentioned above was no longer being delayed.
      
      Rather than moving both wait clauses to the original position of
      rootdelay and risking unearthing other possible corner case breakage
      at this point in time, we simply revert now and we can revisit
      trying the alternate/earlier location in another development cycle.
      
      Cc: Pavel Machek <pavel@denx.de>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8ba4caf1
  12. Aug 28, 2014
  13. Aug 08, 2014
    • Paul Gortmaker's avatar
      init: make rootdelay=N consistent with rootwait behaviour · 4dfe694f
      Paul Gortmaker authored
      
      Currently rootdelay=N and rootwait behave differently (aside from the
      obvious unbounded wait duration) because they are at different places in
      the init sequence.
      
      The difference manifests itself for md devices because the call to
      md_run_setup() lives between rootdelay and rootwait, so if you try to use
      rootdelay=20 to try and allow a slow RAID0 array to assemble, you get
      this:
      
      [    4.526011] sd 6:0:0:0: [sdc] Attached SCSI removable disk
      [   22.972079] md: Waiting for all devices to be available before autodetect
      
      i.e.  you've achieved nothing other than delaying the probing 20s, when
      what you wanted was a 20s delay _after_ the probing for md devices was
      initiated.
      
      Here we move the rootdelay code to be right beside the rootwait code, so
      that their behaviour is consistent.
      
      It should be noted that in doing so, the actions based on the
      saved_root_name[0] and initrd_load() were previously put on hold by
      rootdelay=N and now currently will not be delayed.  However, I think
      consistent behaviour is more important than matching historical behaviour
      of delaying the above two operations.
      
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      4dfe694f
  14. Apr 03, 2014
  15. Nov 13, 2013
  16. Sep 11, 2013
    • Rob Landley's avatar
      initmpfs: use initramfs if rootfstype= or root= specified · 6e19eded
      Rob Landley authored
      
      Command line option rootfstype=ramfs to obtain old initramfs behavior, and
      use ramfs instead of tmpfs for stub when root= defined (for cosmetic
      reasons).
      
      [akpm@linux-foundation.org: coding-style fixes]
      Signed-off-by: default avatarRob Landley <rob@landley.net>
      Cc: Jeff Layton <jlayton@redhat.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Stephen Warren <swarren@nvidia.com>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Jim Cromie <jim.cromie@gmail.com>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      6e19eded
    • Rob Landley's avatar
      initmpfs: make rootfs use tmpfs when CONFIG_TMPFS enabled · 16203a7a
      Rob Landley authored
      
      Conditionally call the appropriate fs_init function and fill_super
      functions.  Add a use once guard to shmem_init() to simply succeed on a
      second call.
      
      (Note that IS_ENABLED() is a compile time constant so dead code
      elimination removes unused function calls when CONFIG_TMPFS is disabled.)
      
      Signed-off-by: default avatarRob Landley <rob@landley.net>
      Cc: Jeff Layton <jlayton@redhat.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Stephen Warren <swarren@nvidia.com>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Jim Cromie <jim.cromie@gmail.com>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      16203a7a
    • Rob Landley's avatar
      initmpfs: move rootfs code from fs/ramfs/ to init/ · 57f150a5
      Rob Landley authored
      
      When the rootfs code was a wrapper around ramfs, having them in the same
      file made sense.  Now that it can wrap another filesystem type, move it in
      with the init code instead.
      
      This also allows a subsequent patch to access rootfstype= command line
      arg.
      
      Signed-off-by: default avatarRob Landley <rob@landley.net>
      Cc: Jeff Layton <jlayton@redhat.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Stephen Warren <swarren@nvidia.com>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Jim Cromie <jim.cromie@gmail.com>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      57f150a5
  17. Jul 03, 2013
  18. Feb 06, 2013
  19. Nov 23, 2012
    • Stephen Warren's avatar
      block: partition: msdos: provide UUIDs for partitions · d33b98fc
      Stephen Warren authored
      
      The MSDOS/MBR partition table includes a 32-bit unique ID, often referred
      to as the NT disk signature.  When combined with a partition number within
      the table, this can form a unique ID similar in concept to EFI/GPT's
      partition UUID.  Constructing and recording this value in struct
      partition_meta_info allows MSDOS partitions to be referred to on the
      kernel command-line using the following syntax:
      
      root=PARTUUID=0002dd75-01
      
      Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Will Drewry <wad@chromium.org>
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      d33b98fc
    • Stephen Warren's avatar
      init: reduce PARTUUID min length to 1 from 36 · 283f8fc0
      Stephen Warren authored
      
      Reduce the minimum length for a root=PARTUUID= parameter to be considered
      valid from 36 to 1.  EFI/GPT partition UUIDs are always exactly 36
      characters long, hence the previous limit.  However, the next patch will
      support DOS/MBR UUIDs too, which have a different, shorter, format.
      Instead of validating any particular length, just ensure that at least
      some non-empty value was given by the user.
      
      Also, consider a missing UUID value to be a parsing error, in the same
      vein as if /PARTNROFF exists and can't be parsed.  As such, make both
      error cases print a message and disable rootwait.  Convert to pr_err while
      we're at it.
      
      Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Will Drewry <wad@chromium.org>
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      283f8fc0
    • Stephen Warren's avatar
      block: store partition_meta_info.uuid as a string · 1ad7e899
      Stephen Warren authored
      
      This will allow other types of UUID to be stored here, aside from true
      UUIDs.  This also simplifies code that uses this field, since it's usually
      constructed from a, used as a, or compared to other, strings.
      
      Note: A simplistic approach here would be to set uuid_str[36]=0 whenever a
      /PARTNROFF option was found to be present.  However, this modifies the
      input string, and causes subsequent calls to devt_from_partuuid() not to
      see the /PARTNROFF option, which causes different results.  In order to
      avoid misleading future maintainers, this parameter is marked const.
      
      Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Will Drewry <wad@chromium.org>
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      1ad7e899
  20. Oct 12, 2012
    • Jeff Layton's avatar
      vfs: allocate page instead of names_cache buffer in mount_block_root · a608ca21
      Jeff Layton authored
      
      First, it's incorrect to call putname() after __getname_gfp() since the
      bare __getname_gfp() call skips the auditing code, while putname()
      doesn't.
      
      mount_block_root allocates a PATH_MAX buffer via __getname_gfp, and then
      calls get_fs_names to fill the buffer. That function can call
      get_filesystem_list which assumes that that buffer is a full page in
      size. On arches where PAGE_SIZE != 4k, then this could potentially
      overrun.
      
      In practice, it's hard to imagine the list of filesystem names even
      approaching 4k, but it's best to be safe. Just allocate a page for this
      purpose instead.
      
      With this, we can also remove the __getname_gfp() definition since there
      are no more callers.
      
      Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      a608ca21
  21. Jun 01, 2012
  22. May 05, 2012
    • Sasha Levin's avatar
      init: don't try mounting device as nfs root unless type fully matches · 377485f6
      Sasha Levin authored
      
      Currently, we'll try mounting any device who's major device number is
      UNNAMED_MAJOR as NFS root.  This would happen for non-NFS devices as
      well (such as 9p devices) but it wouldn't cause any issues since
      mounting the device as NFS would fail quickly and the code proceeded to
      doing the proper mount:
      
             [  101.522716] VFS: Unable to mount root fs via NFS, trying floppy.
             [  101.534499] VFS: Mounted root (9p filesystem) on device 0:18.
      
      Commit 6829a048102a ("NFS: Retry mounting NFSROOT") introduced retries
      when mounting NFS root, which means that now we don't immediately fail
      and instead it takes an additional 90+ seconds until we stop retrying,
      which has revealed the issue this patch fixes.
      
      This meant that it would take an additional 90 seconds to boot when
      we're not using a device type which gets detected in order before NFS.
      
      This patch modifies the NFS type check to require device type to be
      'Root_NFS' instead of requiring the device to have an UNNAMED_MAJOR
      major.  This makes boot process cleaner since we now won't go through
      the NFS mounting code at all when the device isn't an NFS root
      ("/dev/nfs").
      
      Signed-off-by: default avatarSasha Levin <levinsasha928@gmail.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      377485f6
  23. Mar 23, 2012
  24. Jan 07, 2012
  25. Jan 05, 2012
    • Chuck Lever's avatar
      NFS: Retry mounting NFSROOT · 43717c7d
      Chuck Lever authored
      
      Lukas Razik <linux@razik.name> reports that on his SPARC system,
      booting with an NFS root file system stopped working after commit
      56463e50 "NFS: Use super.c for NFSROOT mount option parsing."
      
      We found that the network switch to which Lukas' client was attached
      was delaying access to the LAN after the client's NIC driver reported
      that its link was up.  The delay was longer than the timeouts used in
      the NFS client during mounting.
      
      NFSROOT worked for Lukas before commit 56463e50 because in those
      kernels, the client's first operation was an rpcbind request to
      determine which port the NFS server was listening on.  When that
      request failed after a long timeout, the client simply selected the
      default NFS port (2049).  By that time the switch was allowing access
      to the LAN, and the mount succeeded.
      
      Neither of these client behaviors is desirable, so reverting 56463e50
      is really not a choice.  Instead, introduce a mechanism that retries
      the NFSROOT mount request several times.  This is the same tactic that
      normal user space NFS mounts employ to overcome server and network
      delays.
      
      Signed-off-by: default avatarLukas Razik <linux@razik.name>
      [ cel: match kernel coding style, add proper patch description ]
      [ cel: add exponential back-off ]
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Tested-by: default avatarLukas Razik <linux@razik.name>
      Cc: stable@kernel.org # > 2.6.38
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      43717c7d
  26. Nov 02, 2011
    • Will Drewry's avatar
      init: add root=PARTUUID=UUID/PARTNROFF=%d support · 79975f13
      Will Drewry authored
      
      Expand root=PARTUUID=UUID syntax to support selecting a root partition by
      integer offset from a known, unique partition.  This approach provides
      similar properties to specifying a device and partition number, but using
      the UUID as the unique path prior to evaluating the offset.
      
      For example,
        root=PARTUUID=99DE9194-FC15-4223-9192-FC243948F88B/PARTNROFF=1
      selects the partition with UUID 99DE.. then select the next
      partition.
      
      This change is motivated by a particular usecase in Chromium OS where the
      bootloader can easily determine what partition it is on (by UUID) but
      doesn't perform general partition table walking.
      
      That said, support for this model provides a direct mechanism for the user
      to modify the root partition to boot without specifically needing to
      extract each UUID or update the bootloader explicitly when the root
      partition UUID is changed (if it is recreated to be larger, for instance).
       Pinning to a /boot-style partition UUID allows the arbitrary root
      partition reconfiguration/modifications with slightly less ambiguity than
      just [dev][partition] and less stringency than the specific root partition
      UUID.
      
      [sfr@canb.auug.org.au: fix init sections warning]
      Signed-off-by: default avatarWill Drewry <wad@chromium.org>
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Cc: Randy Dunlap <rdunlap@xenotime.net>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      79975f13
  27. Mar 31, 2011
  28. Mar 23, 2011
Loading