Commit Graph

6 Commits

Author SHA1 Message Date
Brian Behlendorf
f47c42e214 Merge branch 'dracut' 2011-03-22 12:13:04 -07:00
Brian Behlendorf
ec49a5f0ec Fix getcwd() warning
New versions glibc declare getcwd() with the warn_unused_result attribute.
This results in a warning because the updated mount helper was not
checking this return value.  This issue was fixed by checking the return
type and in the case of an error simply returning the passed dataset.
One possible, but unlikely, error would be having your cwd directory
unlinked while the mount command was running.

  cmd/mount_zfs/mount_zfs.c: In function ‘parse_dataset’:
  cmd/mount_zfs/mount_zfs.c:223:2: error: ignoring return value of
      ‘getcwd’, declared with attribute warn_unused_result
2011-03-18 13:54:49 -07:00
Brian Behlendorf
3aff775555 Strip 'zfsutil,remount' from /etc/mtab
When updating /etc/mtab we should be careful and strip certain
options.  In particular, we need to strip 'zfsutil' because if
we don't the mount utility will helpfull provide it to the
mount helper when we issue mount(8) again.  This subverts the
check that the caller is zfs(8) and not mount(8).
2011-03-15 13:33:29 -07:00
Brian Behlendorf
093aa69286 Always allow '-o remount,ro'
Allow the mount(8) utility to always operate on all datasets when
remounting them read-only.  This critical for rc.sysinit/umountroot
which remounts the root filesystem read-only during shutdown to
ensure everything is correctly flushed to disk.

Fix minor typo, the check to set zfsutil should use the bitwise
'&'.  I must have accidentally hit the adjacent '*' and obviously
neither the compiler or my code review caught this.  Fix it now.
2011-03-15 13:33:29 -07:00
Brian Behlendorf
a6cba65cca Check for trailing '/' in mount.zfs
When run with a root '/' cwd the mount.zfs helper would strip not
only the '/' but also the next character from the dataset name.
For example, '/tank' was changed to 'ank' instead of just 'tank'.
Originally, this was done for the '/tmp' cwd case where we needed
to strip the '/' following the cwd.  For example '/tmp/tank' needed
to remove the '/tmp' cwd plus 1 character for the '/'.

This change fixes the problem by checking the cwd and if it ends in
a '/' it does not strip and extra character.  Otherwise it will strip
the next character.  I believe this should only ever be true for the
root directory.

Closes #148
2011-03-10 12:58:44 -08:00
Brian Behlendorf
d53368f675 Fix mount helper
Several issues related to strange mount/umount behavior were reported
and this commit should address most of them.  The original idea was
to put in place a zfs mount helper (mount.zfs).  This helper is used
to enforce 'legacy' mount behavior, and perform any extra mount argument
processing (selinux, zfsutil, etc).  This helper wasn't ready for the
0.6.0-rc1 release but with this change it's functional but needs to
extensively tested.

This change addresses the following open issues.
Closes #101
Closes #107
Closes #113
Closes #115
Closes #119
2011-03-09 15:26:48 -08:00