All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eryu Guan <eguan@redhat.com>
To: Chengguang Xu <cgxu519@icloud.com>
Cc: Amir Goldstein <amir73il@gmail.com>,
	fstests <fstests@vger.kernel.org>,
	linux-unionfs@vger.kernel.org
Subject: Re: [PATCH v3 1/3] common/rc: add scratch shutdown support for overlayfs
Date: Thu, 14 Dec 2017 12:32:23 +0800	[thread overview]
Message-ID: <20171214043223.GC2749@eguan.usersys.redhat.com> (raw)
In-Reply-To: <915A4652-253D-4326-B60A-9CF5504AAED0@icloud.com>

On Thu, Dec 14, 2017 at 11:35:04AM +0800, Chengguang Xu wrote:
> 
> > 
> > 在 2017年12月12日,下午5:16,Eryu Guan <eguan@redhat.com> 写道:
> > 
> > On Tue, Dec 12, 2017 at 11:09:37AM +0800, Chengguang Xu wrote:
> >> OverlayFS overrides SCRATCH_MNT variable to it's own,
> >> so adjust target to underlying filesystem(OVL_BASE_SCRATCH_MNT)
> >> when running shutdown on overlayfs.
> >> 
> >> Signed-off-by: Chengguang Xu <cgxu519@icloud.com>
> >> ---
> >> 
> >> Changes since v2:
> >> 1. Make option for _scratch_shutdown(), so caller can 
> >> specify option when calling.
> >> 2. Add comment for why overlay requires special handling.
> >> 3. Add commit log.
> >> 
> >> Changes since v1:
> >> _scratch_shutdown() does not call notrun.
> >> 
> >> common/rc | 37 +++++++++++++++++++++++++++++++++++--
> >> 1 file changed, 35 insertions(+), 2 deletions(-)
> >> 
> >> diff --git a/common/rc b/common/rc
> >> index 4c053a5..a5c4ace 100644
> >> --- a/common/rc
> >> +++ b/common/rc
> >> @@ -382,6 +382,24 @@ _scratch_cycle_mount()
> >>     _scratch_mount "$opts"
> >> }
> >> 
> >> +_scratch_shutdown()
> >> +{
> >> +	if [ $FSTYP = "overlay" ]; then
> >> +		# In lagacy overlay usage, it may specify directory as 
> > 
> > Trailing whitespace in above line.
> > 
> >> +		# SCRATCH_DEV, in this case OVL_BASE_SCRATCH_DEV
> >> +		# will be null, so check OVL_BASE_SCRATCH_DEV before
> >> +		# running shutdown to avoid shutting down base fs accidently.
> >> +		if [ -z $OVL_BASE_SCRATCH_DEV ]; then
> >> +			echo -n "Ignore shutdown because "
> >> +			echo "$SCRATCH_DEV is not a block device"
> > 
> > Hmm, I think a '_fail "<message>"' would be more appropriate here, so
> > that test fails and exits immediately. Test should call
> > _require_scratch_shutdown first before calling _scratch_shutdown, if
> > not, it indicates a useage error of the helper, we need to prompt the
> > test writer to call _require_scratch_shutdown first in error message.
> 
> 
> The additional check I added here, is mainly for avoiding accident improper shutdown.

Yeah, I understand, and the _fail call I suggested is to exit the test
immediately with a proper error message when such an accident usage is
detected, while current code just prints a message and continues the
rest of the test, which is unnecessary.

> If you think we need to prompt message to indicate should call _require_scratch_shutdown first,
> I think we had better modify godown to implement this function. What do you think?

I just want to see a more specific & clearer error message on such a
usage failure, so people know what to do to correct this error. Similar
to what we do in common/rc::_require_command (_fail "usage:
_require_command <command> [<name>]").

Thanks,
Eryu

  reply	other threads:[~2017-12-14  4:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-12  3:09 [PATCH v3 1/3] common/rc: add scratch shutdown support for overlayfs Chengguang Xu
2017-12-12  3:09 ` [PATCH v3 2/3] common/rc: add a check case in _require_xfs_io_command() to support syncfs Chengguang Xu
2017-12-12  3:09 ` [PATCH v3 3/3] generic/470: add syncfs test Chengguang Xu
2017-12-12  6:00   ` Amir Goldstein
2017-12-12  6:07     ` Chengguang Xu
2017-12-12  9:24   ` [PATCH v3 3/3] generic/471: " Eryu Guan
2017-12-12  9:56     ` Amir Goldstein
2017-12-12 10:05       ` Chengguang Xu
2017-12-12 11:00         ` Amir Goldstein
2017-12-12 13:30         ` Eryu Guan
2017-12-12  5:58 ` [PATCH v3 1/3] common/rc: add scratch shutdown support for overlayfs Amir Goldstein
2017-12-12  9:16 ` Eryu Guan
2017-12-12 10:20   ` Chengguang Xu
2017-12-12 13:39     ` Eryu Guan
2018-01-03 12:44       ` Chengguang Xu
2018-01-03 12:58         ` Amir Goldstein
2018-01-03 14:25           ` Chengguang Xu
2018-01-03 14:54             ` Amir Goldstein
2018-01-10  2:35               ` Chengguang Xu
2017-12-14  3:35   ` Chengguang Xu
2017-12-14  4:32     ` Eryu Guan [this message]
2017-12-14  5:31       ` Chengguang Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171214043223.GC2749@eguan.usersys.redhat.com \
    --to=eguan@redhat.com \
    --cc=amir73il@gmail.com \
    --cc=cgxu519@icloud.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.