From: "Theodore Y. Ts'o" <tytso@mit.edu>
To: linux-scsi@vger.kernel.org, linux-block@vger.kernel.org
Subject: What's the best way to call sd_shutdown() on all SCSI disks on shutdown?
Date: Mon, 30 Jul 2018 15:17:07 -0400 [thread overview]
Message-ID: <20180730191707.GA28569@thunk.org> (raw)
I've been looking at what's the best way to make sure everything gets
cleanly flushed out to disk on a powerdown. Right now in
__orderly_poweroff(), we call emergency_sync() which kicks a workqueue
to flush all file systems and block devices --- and then we
immediately power down the system, before the scheduler even has a
chance to schedule the workqueue thread. Hopefully userspace has the
unmounted all file systems, which will has implicitly issued a cache
flush command, but if we have a userspace program writing to a block
device directly, currently there's nothing to make sure things will
get flushed out to the device.
Beyond that, though, I'm interested in figuring out how to make sure
that all SCSI devices will receive (and acknowledge) SHUTDOWN command
so that the disks can be spun down and heads retracted to a safe
landing zone before we power down the system.
It appears the best way to do this is to call sd_shutdown(), since we
don't seem to have a high-level "shutdown" concept recognized in the
block layer (the way we currently, have, say support for "discard").
So the question is, what's the best way to architect something like
this. I could implement a hacky interator loop in the SCSI subsystem,
and call it directly from __orderly_poweroff in kernel/reboot.c. But
I'm pretty sure that would never get accepted upstream, and so it
would remain a Google data center hack.
What do people think would be the best way of implementing something
that would be upstream acceptable?
Thanks,
- Ted
next reply other threads:[~2018-07-30 20:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-30 19:17 Theodore Y. Ts'o [this message]
2018-07-30 20:35 ` What's the best way to call sd_shutdown() on all SCSI disks on shutdown? Bart Van Assche
2018-07-30 20:35 ` James Bottomley
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=20180730191707.GA28569@thunk.org \
--to=tytso@mit.edu \
--cc=linux-block@vger.kernel.org \
--cc=linux-scsi@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.