mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zach Brown <zach.brown@oracle.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	linux-rt-users <linux-rt-users@vger.kernel.org>,
	mingo@goodmis.org, Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [HACK] convert i_alloc_sem for direct_io.c craziness!
Date: Mon, 1 Oct 2007 12:52:56 -0700	[thread overview]
Message-ID: <20071001195256.GB7718@mami.zabbo.net> (raw)
In-Reply-To: <Pine.LNX.4.58.0709241700290.13164@gandalf.stny.rr.com>

> Hopefully I will get some attention from those that are responsible for
> fs/direct_io.c

[ many days later, I find this amongst the lkml noise. ]

> This patch converts the i_alloc_sem into a compat_rw_semaphore for the -rt
> patch.  Seems that the code in fs/direct_io.c does some nasty logic with
> the i_alloc_sem.  For DIO_LOCKING, I'm assuming that the i_alloc_sem is
> used as a reference counter for pending requests. When the request is
> made, the down_read is performed. When the request is handled by the block
> softirq, then that softirq does an up on the request. So the owner is not
> the same between down and up. When all requests are handled, the semaphore
> counter should be zero. This keeps away any write access while requests
> are pending.

Yeah.  This is used for performing concurrent asynchronous O_DIRECT
operations.

> This patch converts (for now) the i_alloc_sem into a compat_rw_semaphore
> to give back the old features to the sem. This fixes deadlocks that we've
> been having WRT direct_io.

*nod*

> The real fix would be to get rid of the read semaphore trickery in
> direct_io.c.

Do you have any suggestions for locking constructs that RT would prefer?

The core problem is that async IO is in flight while no process holds
the usual locks in system calls.  We don't want the blocks referenced by
IOs to be freed and realocated some where else while the IO is in
flight.  Hence the i_alloc_sem acquiry in the file block modification
paths: vmtruncate - free, notify_change - a proxy for allocating writes.

The agents are:

- many tasks issuing concurrent async IO and exiting from system calls
while the IO is still in flight

- operations completed in interrupt handlers from storage devices

- tasks changing file block mapping via system calls

There's some long-term work to integrate the locking between the
buffered and O_DIRECT paths, but it's not close to ready.

- z

  parent reply	other threads:[~2007-10-01 19:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-24 21:14 Steven Rostedt
2007-09-25 12:42 ` Peter Zijlstra
2007-09-25 15:29   ` [PATCH RT] Don't let -rt rw_semaphors do _non_owner locks Steven Rostedt
2007-10-01 19:52 ` Zach Brown [this message]
2007-10-01 20:39   ` [HACK] convert i_alloc_sem for direct_io.c craziness! Peter Zijlstra
2007-10-02 18:03     ` Zach Brown
2007-10-02 18:12       ` Steven Rostedt
2007-10-02 18:18         ` Zach Brown

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=20071001195256.GB7718@mami.zabbo.net \
    --to=zach.brown@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=mingo@goodmis.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®