From: Helge Deller <deller@gmx.de>
To: Nam Cao <namcao@linutronix.de>, Daniel Vetter <daniel@ffwll.ch>,
Antonino Daplas <adaplas@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Paul Mundt <lethal@linux-sh.org>,
linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Cc: bigeasy@linutronix.de, stable@vger.kernel.org
Subject: Re: [PATCH 1/2] fb: flush deferred work in fb_deferred_io_fsync()
Date: Tue, 19 Dec 2023 08:43:25 +0100 [thread overview]
Message-ID: <4dd7ec87-eceb-4015-a0a0-45f6f0c12e9d@gmx.de> (raw)
In-Reply-To: <d15187348e7d7f76b7a1adf95aa5e3e3ecfc10b4.1702890493.git.namcao@linutronix.de>
On 12/18/23 10:57, Nam Cao wrote:
> The driver's fsync() is supposed to flush any pending operation to
> hardware. It is implemented in this driver by cancelling the queued
> deferred IO first, then schedule it for "immediate execution" by calling
> schedule_delayed_work() again with delay=0. However, setting delay=0
> only means the work is scheduled immediately, it does not mean the work
> is executed immediately. There is no guarantee that the work is finished
> after schedule_delayed_work() returns. After this driver's fsync()
> returns, there can still be pending work. Furthermore, if close() is
> called by users immediately after fsync(), the pending work gets
> cancelled and fsync() may do nothing.
>
> To ensure that the deferred IO completes, use flush_delayed_work()
> instead. Write operations to this driver either write to the device
> directly, or invoke schedule_delayed_work(); so by flushing the
> workqueue, it can be guaranteed that all previous writes make it to the
> device.
>
> Fixes: 5e841b88d23d ("fb: fsync() method for deferred I/O flush.")
> Cc: stable@vger.kernel.org
> Signed-off-by: Nam Cao <namcao@linutronix.de>
> Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
> drivers/video/fbdev/core/fb_defio.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
both patches applied to fbdev for-next git tree.
Thanks!
Helge
next prev parent reply other threads:[~2023-12-19 7:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-18 9:57 [PATCH 0/2] fix LCD diplays sporadically not work Nam Cao
2023-12-18 9:57 ` [PATCH 1/2] fb: flush deferred work in fb_deferred_io_fsync() Nam Cao
2023-12-19 7:43 ` Helge Deller [this message]
2023-12-18 9:57 ` [PATCH 2/2] fb: flush deferred IO before closing Nam Cao
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=4dd7ec87-eceb-4015-a0a0-45f6f0c12e9d@gmx.de \
--to=deller@gmx.de \
--cc=adaplas@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=bigeasy@linutronix.de \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=lethal@linux-sh.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=namcao@linutronix.de \
--cc=stable@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 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).