Re: [PATCH] When discovering dirtiness of filesystems, mount the /mnt/sysimage read only Resolves: rhbz#601862

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I was considering merging this to mount code, but I decided to abstract the options=r?,remount from the high level logic. I would have to add remount= argument to the mount call as we pass the remount option to isys in this form.

This code also behaves more like unmount call (checking for mounted and existing filesystem first). On the other hand there is a significant part common with the mount call too, especially the SElinux handling.

--
Martin SivÃk
msivak@xxxxxxxxxx
Red Hat Czech
Anaconda team / Brno, CZ

----- Original Message -----
> > diff --git a/storage/formats/fs.py b/storage/formats/fs.py
> > index 646194c..77a459c 100644
> > --- a/storage/formats/fs.py
> > +++ b/storage/formats/fs.py
> > @@ -632,6 +632,44 @@ class FS(DeviceFormat):
> >
> >          self._mountpoint = chrootedMountpoint
> >
> > + def remount(self, *args, **kwargs):
> > + """ Remount the filesystem with new options """
> > + options = kwargs.get("options", "")
> > + log.info("remounting %s on %s", self.device, self._mountpoint)
> > +
> > + if not self.exists:
> > + raise FSError("filesystem has not been created")
> > +
> > + if not self._mountpoint:
> > + # not mounted
> > + return
> > +
> > + if not os.path.exists(self._mountpoint):
> > + raise FSError("mountpoint does not exist")
> > +
> > + # passed in options override default options
> > + if not options or not isinstance(options, str):
> > + options = self.options
> > +
> > + try:
> > + rc = isys.mount(self.device, self._mountpoint,
> > + fstype=self.mountType,
> > + options=options, remount=True,
> > + bindMount=isinstance(self, BindFS))
> > + except Exception as e:
> > + raise FSError("mount failed: %s" % e)
> > +
> > + if rc:
> > + raise FSError("mount failed: %s" % rc)
> > +
> > + if flags.selinux:
> > + ret = isys.resetFileContext(self._mountpoint, "")
> > + log.info("set SELinux context for newly mounted filesystem "
> > + "root at %s to %s" %(self._mountpoint, ret))
> > + isys.setFileContext("%s/lost+found" % self._mountpoint,
> > + lost_and_found_context, "")
> > +
> > +
> >      def unmount(self):
> >          """ Unmount this filesystem. """
> >          if not self.exists:
> 
> The idea looks sound, but it'd be nice if the remount() method could
> either be a wrapper around mount() or removed and mount() called
> directly. Perhaps this could be as simple as adding ",remount" to the
> options= parameter? Or is there something else hiding in mount that
> prevents this?
> 
> - Chris
> 
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list



[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux