Re: about test mount/rlimit

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

 



On Thu, Apr 02, 2015 at 12:05:20PM +0200, Ruediger Meier wrote:
> On Thursday 02 April 2015, Karel Zak wrote:
> > On Wed, Apr 01, 2015 at 02:04:27PM +0200, Ruediger Meier wrote:
> > > ts_init_subtest "umount"
> > > [ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
> > > $TS_CMD_MOUNT $DEVICE $TS_MOUNTPOINT &> /dev/null
> > > OLD_SUM=$(mtab_checksum)
> > > (
> > >         ulimit -f 1
> > >         $TS_CMD_UMOUNT $TS_MOUNTPOINT &> /dev/null
> > > ) &> /dev/null
> > > NEW_SUM=$(mtab_checksum)
> > > $TS_CMD_UMOUNT $TS_MOUNTPOINT &> /dev/null
> > > [ $NEW_SUM = $OLD_SUM ] && echo "OK: mtab unmodified by umount" >>
> > > $TS_OUTPUT
> > > ts_finalize_subtest
> > > ...........
> > >
> > > I do not fully understand what is expected. Obviously the first
> > > "umount" should NOT modify /etc/mtab. But should it umount or not,
> > > or doesn't matter? Why we call a second umount then?
> >
> > I guess the second umount is just copy & past (from mount test) and
> 
> Ah, now it makes sense. So the first umount should work and we could
> check "ismounted" too.

yes

> BTW could it be that in past "umount" always removed the mtab entry
> like "--fake" still does for umounted devices?

git show v2.13:mount/umount.c

       if (!nomtab &&
             (umnt_err == 0 || umnt_err == EINVAL || umnt_err == ENOENT)) {
                 update_mtab (node, NULL);
       }


so yes, but for me it's little bit fragile (for example EINVAL means
wrong mount options in same situations, unreachable mountpoint maybe
in situation when it's hidden by another mount and with namespaces it
does not make sense at all).

Thanks God that mtab is dead.

> Ah that's good. I'll send a patch with some other fixes later.
> The umount part would look like this: 
> 
>  	$TS_CMD_UMOUNT $TS_MOUNTPOINT &> /dev/null
>  ) &> /dev/null
>  NEW_SUM=$(mtab_checksum)
> -$TS_CMD_UMOUNT $TS_MOUNTPOINT &> /dev/null
>  [ $NEW_SUM = $OLD_SUM ] && echo "OK: mtab unmodified by umount" >> $TS_OUTPUT
> +ts_is_mounted $DEVICE && echo "FAIL: $DEVICE is still mounted" >> $TS_OUTPUT
> +# repair /etc/mtab
> +$TS_CMD_UMOUNT --fake $TS_MOUNTPOINT &> /dev/null
> +ts_is_mounted $DEVICE && ts_die "$DEVICE is still mounted"
>  ts_finalize_subtest

Seems good.

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux