Re: [PATCH] ATA over Ethernet: Convert emsgs_sema in a completion
From: Andrew Morton
Date: Wed May 21 2008 - 14:38:48 EST
On Wed, 21 May 2008 10:49:24 -0400 "Ed L. Cashin" <ecashin@xxxxxxxxxx> wrote:
> On Mon, May 19, 2008 at 04:51:22PM -0700, Andrew Morton wrote:
> > On Fri, 16 May 2008 21:11:33 +0200
> > Matthias Kaehlcke <matthias@xxxxxxxxxxxx> wrote:
> > > @@ -216,7 +217,7 @@ aoechr_read(struct file *filp, char __user *buf, size_t cnt, loff_t *off)
> > >
> > > spin_unlock_irqrestore(&emsgs_lock, flags);
> > >
> > > - n = down_interruptible(&emsgs_sema);
> > > + n = wait_for_completion_interruptible(&emsgs_comp);
> > Patch looks OK, but I worry about this code. Suppose a signal is sent
> > and we return to userspace with the complete() still outstanding. Then
> > someone removes the module.
> > Perhaps there is synchronisation code which prevents that crash?
> I plan to answer this question soon. Right now I am quite busy.
> This emsgs_sema part of the aoe driver has never caused any problems
> for users but has caused many problems for me, because it is tricky to
> think about, to talk about, and for others to patch.
> I hope that there is a more straightforward way to get the current
> read-from-the-file-forever behavior using an existing kernel
> facility. A user currently can do,
> cat /dev/etherd/err
> ... and have it block, waiting until there is an error to report,
> printing it, and then blocking again, like reading from a pipe.
That's fine - the normal way of handling that is for the user's fd to
hold a reference against the module itself.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/