linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs: export emergency_sync
@ 2023-07-18 21:45 Rob Barnes
  2023-07-18 22:13 ` Bill O'Donnell
  0 siblings, 1 reply; 10+ messages in thread
From: Rob Barnes @ 2023-07-18 21:45 UTC (permalink / raw)
  To: bleung, linux-fsdevel
  Cc: Rob Barnes, Alexander Viro, Christian Brauner, linux-kernel

emergency_sync forces a filesystem sync in emergency situations.
Export this function so it can be used by modules.

Signed-off-by: Rob Barnes <robbarnes@google.com>
---

 fs/sync.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/sync.c b/fs/sync.c
index dc725914e1edb..b313db0ebb5ee 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -142,6 +142,7 @@ void emergency_sync(void)
 		schedule_work(work);
 	}
 }
+EXPORT_SYMBOL(emergency_sync);
 
 /*
  * sync a single super
-- 
2.41.0.255.g8b1d071c50-goog


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] fs: export emergency_sync
  2023-07-18 21:45 [PATCH] fs: export emergency_sync Rob Barnes
@ 2023-07-18 22:13 ` Bill O'Donnell
  2023-07-18 22:18   ` Rob Barnes
  2023-07-19  4:08   ` Guenter Roeck
  0 siblings, 2 replies; 10+ messages in thread
From: Bill O'Donnell @ 2023-07-18 22:13 UTC (permalink / raw)
  To: Rob Barnes
  Cc: bleung, linux-fsdevel, Alexander Viro, Christian Brauner, linux-kernel

On Tue, Jul 18, 2023 at 09:45:40PM +0000, Rob Barnes wrote:
> emergency_sync forces a filesystem sync in emergency situations.
> Export this function so it can be used by modules.
> 
> Signed-off-by: Rob Barnes <robbarnes@google.com>

Example of an emergency situation?
Thanks-
Bill


> ---
> 
>  fs/sync.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/sync.c b/fs/sync.c
> index dc725914e1edb..b313db0ebb5ee 100644
> --- a/fs/sync.c
> +++ b/fs/sync.c
> @@ -142,6 +142,7 @@ void emergency_sync(void)
>  		schedule_work(work);
>  	}
>  }
> +EXPORT_SYMBOL(emergency_sync);
>  
>  /*
>   * sync a single super
> -- 
> 2.41.0.255.g8b1d071c50-goog
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] fs: export emergency_sync
  2023-07-18 22:13 ` Bill O'Donnell
@ 2023-07-18 22:18   ` Rob Barnes
  2023-07-19  4:08   ` Guenter Roeck
  1 sibling, 0 replies; 10+ messages in thread
From: Rob Barnes @ 2023-07-18 22:18 UTC (permalink / raw)
  To: Bill O'Donnell
  Cc: bleung, linux-fsdevel, Alexander Viro, Christian Brauner, linux-kernel

My use case is when the EC panics. A hard reset is imminent. In my
testing a regular sync did not always sync all of the logs. See
https://lore.kernel.org/all/20230717232932.1.I361812b405bd07772f66660624188339ab158772@changeid

On Tue, Jul 18, 2023 at 4:13 PM Bill O'Donnell <billodo@redhat.com> wrote:
>
> On Tue, Jul 18, 2023 at 09:45:40PM +0000, Rob Barnes wrote:
> > emergency_sync forces a filesystem sync in emergency situations.
> > Export this function so it can be used by modules.
> >
> > Signed-off-by: Rob Barnes <robbarnes@google.com>
>
> Example of an emergency situation?
> Thanks-
> Bill
>
>
> > ---
> >
> >  fs/sync.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/fs/sync.c b/fs/sync.c
> > index dc725914e1edb..b313db0ebb5ee 100644
> > --- a/fs/sync.c
> > +++ b/fs/sync.c
> > @@ -142,6 +142,7 @@ void emergency_sync(void)
> >               schedule_work(work);
> >       }
> >  }
> > +EXPORT_SYMBOL(emergency_sync);
> >
> >  /*
> >   * sync a single super
> > --
> > 2.41.0.255.g8b1d071c50-goog
> >
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] fs: export emergency_sync
  2023-07-18 22:13 ` Bill O'Donnell
  2023-07-18 22:18   ` Rob Barnes
@ 2023-07-19  4:08   ` Guenter Roeck
  2023-07-19  5:53     ` Christian Brauner
  1 sibling, 1 reply; 10+ messages in thread
From: Guenter Roeck @ 2023-07-19  4:08 UTC (permalink / raw)
  To: Bill O'Donnell
  Cc: Rob Barnes, bleung, linux-fsdevel, Alexander Viro,
	Christian Brauner, linux-kernel

On Tue, Jul 18, 2023 at 05:13:06PM -0500, Bill O'Donnell wrote:
> On Tue, Jul 18, 2023 at 09:45:40PM +0000, Rob Barnes wrote:
> > emergency_sync forces a filesystem sync in emergency situations.
> > Export this function so it can be used by modules.
> > 
> > Signed-off-by: Rob Barnes <robbarnes@google.com>
> 
> Example of an emergency situation?

An example from existing code in
drivers/firmware/arm_scmi/scmi_power_control.c:

static inline void
scmi_request_forceful_transition(struct scmi_syspower_conf *sc)
{
        dev_dbg(sc->dev, "Serving forceful request:%d\n",
                sc->required_transition);

#ifndef MODULE
        emergency_sync();
#endif

Arguably emergency_sync() should also be called if the file is built
as module.

Either case, I think it would make sense to add an example to the commit
description.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] fs: export emergency_sync
  2023-07-19  4:08   ` Guenter Roeck
@ 2023-07-19  5:53     ` Christian Brauner
  2023-07-19  6:31       ` Christoph Hellwig
  2023-07-19 13:21       ` Guenter Roeck
  0 siblings, 2 replies; 10+ messages in thread
From: Christian Brauner @ 2023-07-19  5:53 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Bill O'Donnell, Rob Barnes, bleung, linux-fsdevel,
	Alexander Viro, linux-kernel

On Tue, Jul 18, 2023 at 09:08:06PM -0700, Guenter Roeck wrote:
> On Tue, Jul 18, 2023 at 05:13:06PM -0500, Bill O'Donnell wrote:
> > On Tue, Jul 18, 2023 at 09:45:40PM +0000, Rob Barnes wrote:
> > > emergency_sync forces a filesystem sync in emergency situations.
> > > Export this function so it can be used by modules.
> > > 
> > > Signed-off-by: Rob Barnes <robbarnes@google.com>
> > 
> > Example of an emergency situation?
> 
> An example from existing code in
> drivers/firmware/arm_scmi/scmi_power_control.c:
> 
> static inline void
> scmi_request_forceful_transition(struct scmi_syspower_conf *sc)
> {
>         dev_dbg(sc->dev, "Serving forceful request:%d\n",
>                 sc->required_transition);
> 
> #ifndef MODULE
>         emergency_sync();
> #endif
> 
> Arguably emergency_sync() should also be called if the file is built
> as module.
> 
> Either case, I think it would make sense to add an example to the commit
> description.

On vacation until next. Please add a proper rationale why and who this
export is needed by in the commit message. As right now it looks like
someone thought it would be good to have which is not enough for
something to become an export.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] fs: export emergency_sync
  2023-07-19  5:53     ` Christian Brauner
@ 2023-07-19  6:31       ` Christoph Hellwig
  2023-07-19 20:51         ` Dmitry Torokhov
  2023-07-19 13:21       ` Guenter Roeck
  1 sibling, 1 reply; 10+ messages in thread
From: Christoph Hellwig @ 2023-07-19  6:31 UTC (permalink / raw)
  To: Christian Brauner
  Cc: Guenter Roeck, Bill O'Donnell, Rob Barnes, bleung,
	linux-fsdevel, Alexander Viro, linux-kernel

On Wed, Jul 19, 2023 at 07:53:32AM +0200, Christian Brauner wrote:
> On vacation until next. Please add a proper rationale why and who this
> export is needed by in the commit message. As right now it looks like
> someone thought it would be good to have which is not enough for
> something to become an export.

emergency_sync is a relaly bad idea and has all kinds of issues.
It should go away and not grow more users outside of core code,
and the one Guenther points to should never have been added.

If we want to allow emergency shutdowns it needs a proper interface
and not a remount read-only ignoring some rules that tends to make
things worse and instad of better, and even for that I'm not sure
I want modules to be able to drive it.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] fs: export emergency_sync
  2023-07-19  5:53     ` Christian Brauner
  2023-07-19  6:31       ` Christoph Hellwig
@ 2023-07-19 13:21       ` Guenter Roeck
  2023-07-31 19:18         ` Christian Brauner
  1 sibling, 1 reply; 10+ messages in thread
From: Guenter Roeck @ 2023-07-19 13:21 UTC (permalink / raw)
  To: Christian Brauner
  Cc: Bill O'Donnell, Rob Barnes, bleung, linux-fsdevel,
	Alexander Viro, linux-kernel

On 7/18/23 22:53, Christian Brauner wrote:
> On Tue, Jul 18, 2023 at 09:08:06PM -0700, Guenter Roeck wrote:
>> On Tue, Jul 18, 2023 at 05:13:06PM -0500, Bill O'Donnell wrote:
>>> On Tue, Jul 18, 2023 at 09:45:40PM +0000, Rob Barnes wrote:
>>>> emergency_sync forces a filesystem sync in emergency situations.
>>>> Export this function so it can be used by modules.
>>>>
>>>> Signed-off-by: Rob Barnes <robbarnes@google.com>
>>>
>>> Example of an emergency situation?
>>
>> An example from existing code in
>> drivers/firmware/arm_scmi/scmi_power_control.c:
>>
>> static inline void
>> scmi_request_forceful_transition(struct scmi_syspower_conf *sc)
>> {
>>          dev_dbg(sc->dev, "Serving forceful request:%d\n",
>>                  sc->required_transition);
>>
>> #ifndef MODULE
>>          emergency_sync();
>> #endif
>>
>> Arguably emergency_sync() should also be called if the file is built
>> as module.
>>
>> Either case, I think it would make sense to add an example to the commit
>> description.
> 
> On vacation until next. Please add a proper rationale why and who this
> export is needed by in the commit message. As right now it looks like
> someone thought it would be good to have which is not enough for
> something to become an export.


No, this is just wrong. Did you read Rob's response ? I just pointed out
that there is another user.

Guenter


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] fs: export emergency_sync
  2023-07-19  6:31       ` Christoph Hellwig
@ 2023-07-19 20:51         ` Dmitry Torokhov
  2023-07-31  7:23           ` Christoph Hellwig
  0 siblings, 1 reply; 10+ messages in thread
From: Dmitry Torokhov @ 2023-07-19 20:51 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Christian Brauner, Guenter Roeck, Bill O'Donnell, Rob Barnes,
	bleung, linux-fsdevel, Alexander Viro, linux-kernel

On Tue, Jul 18, 2023 at 11:31:49PM -0700, Christoph Hellwig wrote:
> On Wed, Jul 19, 2023 at 07:53:32AM +0200, Christian Brauner wrote:
> > On vacation until next. Please add a proper rationale why and who this
> > export is needed by in the commit message. As right now it looks like
> > someone thought it would be good to have which is not enough for
> > something to become an export.
> 
> emergency_sync is a relaly bad idea and has all kinds of issues.
> It should go away and not grow more users outside of core code,
> and the one Guenther points to should never have been added.
> 
> If we want to allow emergency shutdowns it needs a proper interface
> and not a remount read-only ignoring some rules that tends to make
> things worse and instad of better, and even for that I'm not sure
> I want modules to be able to drive it.

I am not sure why you would not want modules to use it - in the case we
have here we detect a catastrophic failure in a critical system
component (embedded controller crashed) and would like to have as much
of the logs saved as possible. It is a module because this kind of EC
may not be present on every system, but when it is present it is very
much a core component.

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] fs: export emergency_sync
  2023-07-19 20:51         ` Dmitry Torokhov
@ 2023-07-31  7:23           ` Christoph Hellwig
  0 siblings, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2023-07-31  7:23 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Christoph Hellwig, Christian Brauner, Guenter Roeck,
	Bill O'Donnell, Rob Barnes, bleung, linux-fsdevel,
	Alexander Viro, linux-kernel

On Wed, Jul 19, 2023 at 01:51:25PM -0700, Dmitry Torokhov wrote:
> I am not sure why you would not want modules to use it - in the case we
> have here we detect a catastrophic failure in a critical system
> component (embedded controller crashed) and would like to have as much
> of the logs saved as possible. It is a module because this kind of EC
> may not be present on every system, but when it is present it is very
> much a core component.

I really don't think this is a kernel poicy in any way.  Please do
a userspace upcall and let userspace deal with the policy decision.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] fs: export emergency_sync
  2023-07-19 13:21       ` Guenter Roeck
@ 2023-07-31 19:18         ` Christian Brauner
  0 siblings, 0 replies; 10+ messages in thread
From: Christian Brauner @ 2023-07-31 19:18 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Bill O'Donnell, Rob Barnes, bleung, linux-fsdevel,
	Alexander Viro, linux-kernel

> that there is another user.

The fact that another non-module user exists is irrelevant to whether or
not this will become an export.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-07-31 19:19 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-18 21:45 [PATCH] fs: export emergency_sync Rob Barnes
2023-07-18 22:13 ` Bill O'Donnell
2023-07-18 22:18   ` Rob Barnes
2023-07-19  4:08   ` Guenter Roeck
2023-07-19  5:53     ` Christian Brauner
2023-07-19  6:31       ` Christoph Hellwig
2023-07-19 20:51         ` Dmitry Torokhov
2023-07-31  7:23           ` Christoph Hellwig
2023-07-19 13:21       ` Guenter Roeck
2023-07-31 19:18         ` Christian Brauner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).