Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Jun 2016 15:17:05 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Peter Holm <peter@holm.cc>
Cc:        richard bader <richard@bader-muenchen.de>, freebsd-fs@freebsd.org
Subject:   Re: disk space not freed when deleting files in null_mounted filesystem
Message-ID:  <20160609121705.GB38613@kib.kiev.ua>
In-Reply-To: <20160609121126.GA46828@x2.osted.lan>
References:  <2e11d942-0856-7ce4-56ef-3774046f8df8@bader-muenchen.de> <20160609112703.GA42321@x2.osted.lan> <92c2f5f8-a5fc-4947-1e65-252543a2569e@bader-muenchen.de> <20160609121126.GA46828@x2.osted.lan>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jun 09, 2016 at 02:11:26PM +0200, Peter Holm wrote:
> On Thu, Jun 09, 2016 at 01:39:45PM +0200, richard bader wrote:
> > Am 09.06.2016 um 13:27 schrieb Peter Holm:
> > > On Thu, Jun 09, 2016 at 12:13:08PM +0200, richard bader wrote:
> > >> Hello,
> > >>
> > >> i've a filesystem mounted with mount_nullfs.
> > >> When i delete a large file in this filesystem, the space on the disk is
> > >> not freed.
> > >> The space becomes freed when i unmount the filesystem.
> > >>
> > >>
> > >> to reproduce this:
> > >>
> > >> root@main2:/tmp # mkdir lnk src
> > >> root@main2:/tmp # mount_nullfs src lnk
> > >> root@main2:/tmp # mount | grep lnk
> > >> /tmp/src on /tmp/lnk (nullfs, local)
> > >> root@main2:/tmp # df -h .
> > >> Filesystem     Size    Used   Avail Capacity  Mounted on
> > >> /dev/ada0p2     58G     40G     13G    75%    /
> > >> root@main2:/tmp # dd if=/dev/zero of=lnk/foo bs=1G count=3
> > >> 3+0 records in
> > >> 3+0 records out
> > >> 3221225472 bytes transferred in 7.856793 secs (409992411 bytes/sec)
> > >> root@main2:/tmp # df -h .
> > >> Filesystem     Size    Used   Avail Capacity  Mounted on
> > >> /dev/ada0p2     58G     43G     10G    80%    /
> > >> root@main2:/tmp # rm lnk/foo
> > >> root@main2:/tmp # df -h .
> > >> Filesystem     Size    Used   Avail Capacity  Mounted on
> > >> /dev/ada0p2     58G     43G     10G    80%    /
> > >> root@main2:/tmp # umount /tmp/lnk
> > >> root@main2:/tmp # df -h .
> > >> Filesystem     Size    Used   Avail Capacity  Mounted on
> > >> /dev/ada0p2     58G     40G     13G    75%    /
> > >>
> > >>
> > >> my system:
> > >>
> > >> root@main2:/tmp # uname -a
> > >> FreeBSD main2.bader.loc 10.2-RELEASE-p18 FreeBSD 10.2-RELEASE-p18 #8
> > >> r301112: Wed Jun  1 11:08:24 CEST 2016
> > >> root@main2.bader.loc:/usr/obj/usr/src/sys/MYKERNEL  amd64
> > >>
> > >> are the any options for mount_nullfs ?
> > >>
> > >> best regards
> > >>
> > >> richard
> > >>
> > > Hello Richard,
> > >
> > > I wonder which file system you are using?
> > > Here's what happens with UFS and current from today:
> > >
> > > $ cat -n richard.sh
> > >       1  #!/bin/sh
> > >       2
> > >       3  uname -a
> > >       4  mount | grep `df -h /tmp | tail -1 | awk '{print $1}'`
> > >       5
> > >       6  cd /tmp
> > >       7  rm -rf lnk src
> > >       8  mkdir lnk src
> > >       9  mount_nullfs src lnk
> > >      10  mount | grep lnk
> > >      11  df -h .
> > >      12  dd if=/dev/zero of=lnk/foo bs=1G count=3
> > >      13  df -h .
> > >      14  rm lnk/foo
> > >      15  df -h .
> > >      16  umount /tmp/lnk
> > >      17  df -h .
> > > $ ./richard.sh
> > > FreeBSD t2.osted.lan 11.0-ALPHA2 FreeBSD 11.0-ALPHA2 #0 r301722: Thu Jun  9 12:09:39 CEST 2016     pho@t2.osted.lan:/usr/src/sys/amd64/compile/PHO  amd64
> > > /dev/da0p3 on /tmp (ufs, NFS exported, local, soft-updates)
> > > /tmp/src on /tmp/lnk (nullfs, local)
> > > Filesystem    Size    Used   Avail Capacity  Mounted on
> > > /dev/da0p3     97G    1,6G     87G     2%    /tmp
> > > 3+0 records in
> > > 3+0 records out
> > > 3221225472 bytes transferred in 47.658947 secs (67589102 bytes/sec)
> > > Filesystem    Size    Used   Avail Capacity  Mounted on
> > > /dev/da0p3     97G    4,6G     84G     5%    /tmp
> > > Filesystem    Size    Used   Avail Capacity  Mounted on
> > > /dev/da0p3     97G    1,6G     87G     2%    /tmp
> > > Filesystem    Size    Used   Avail Capacity  Mounted on
> > > /dev/da0p3     97G    1,6G     87G     2%    /tmp
> > > $
> > >
> > > - Peter
> > i'm also using ufs.
> > 
> > root@main2:/tmp # ./richard.sh
> > FreeBSD main2.bader.loc 10.2-RELEASE-p18 FreeBSD 10.2-RELEASE-p18 #8 
> > r301112: Wed Jun  1 11:08:24 CEST 2016 
> > root@main2.bader.loc:/usr/obj/usr/src/sys/MYKERNEL  amd64
> > /dev/ada0p2 on / (ufs, local, journaled soft-updates)
> > /tmp/src on /tmp/lnk (nullfs, local)
> > Filesystem     Size    Used   Avail Capacity  Mounted on
> > /dev/ada0p2     58G     40G     13G    75%    /
> > 3+0 records in
> > 3+0 records out
> > 3221225472 bytes transferred in 8.679717 secs (371121023 bytes/sec)
> > Filesystem     Size    Used   Avail Capacity  Mounted on
> > /dev/ada0p2     58G     43G     10G    80%    /
> > Filesystem     Size    Used   Avail Capacity  Mounted on
> > /dev/ada0p2     58G     43G     10G    80%    /
> > Filesystem     Size    Used   Avail Capacity  Mounted on
> > /dev/ada0p2     58G     40G     13G    75%    /
> > 
> 
> Hmm. I tried again on SU+J but I still do not see any problems on
> HEAD. I'll build r301112 and see what happens.

There were several bugs fixed since 10.2 in nullfs.  Use -o nocache
to disable nullfs vnode caching, which most likely fix it for 10.2.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160609121705.GB38613>