Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Oct 2004 12:56:08 -0700 (PDT)
From:      Don Lewis <truckman@FreeBSD.org>
To:        saggarwa@cs.utah.edu
Cc:        freebsd-hackers@FreeBSD.org
Subject:   Re: flushing disk buffer cache
Message-ID:  <200410291956.i9TJu8fL027071@gw.catspoiler.org>
In-Reply-To: <Pine.GSO.4.50L0.0410291326580.28852-100000@faith.cs.utah.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
On 29 Oct, Siddharth Aggarwal wrote:
> 
> Thanks for your reply.
> 
> Hmm. At the moment, the user can send an ioctl to define a checkpoint. But
> I would guess that this could happen between 2 strategy() function calls
> corresponding to the same filesystem operation?

Yes.

> So if there a way to block
> filesystem operations while a snapshot is taken? I can't unmount an active
> filesystem before the snapshot and remount it after. Any suggestions?

Yes, this is done by the following code in ffs_snapshot():

        /*
         * Suspend operation on filesystem.
         */
        for (;;) {
                vn_finished_write(wrtmp);
                if ((error = vfs_write_suspend(vp->v_mount)) != 0) {
                        vn_start_write(NULL, &wrtmp, V_WAIT);
                        vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
                        goto out;
                }
                if (mp->mnt_kern_flag & MNTK_SUSPENDED)
                        break;
                vn_start_write(NULL, &wrtmp, V_WAIT);
        }

I think the snapshot code works at a higher level than what you are
implementing, so I believe that the snapshot code doesn't need to sync
all the files to create a consistent snapshot.  You may run into
problems with syncing unwritten data while writing is suspended, but I'm
not sure because don't understand the code all that well.



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