mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tom Zanussi <zanussi@us.ibm.com>
To: Roman Zippel <zippel@linux-m68k.org>
Cc: Tom Zanussi <zanussi@us.ibm.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Greg KH <greg@kroah.com>, Andrew Morton <akpm@osdl.org>,
	Andi Kleen <ak@muc.de>, Robert Wisniewski <bob@watson.ibm.com>,
	Tim Bird <tim.bird@AM.SONY.COM>,
	karim@opersys.com
Subject: Re: [PATCH] relayfs redux, part 2
Date: Tue, 1 Feb 2005 09:44:50 -0600	[thread overview]
Message-ID: <16895.41970.832512.893906@tut.ibm.com> (raw)
In-Reply-To: <Pine.LNX.4.61.0501312247150.30794@scrub.home>

Roman Zippel writes:
 > Hi,
 > 
 > On Fri, 28 Jan 2005, Tom Zanussi wrote:
 > 
 > > +static inline int rchan_create_file(const char *chanpath,
 > > +				    struct dentry **dentry,
 > > +				    struct rchan_buf *data)
 > > +{
 > > +	int err;
 > > +	const char * fname;
 > > +	struct dentry *topdir;
 > > +
 > > +	err = rchan_create_dir(chanpath, &fname, &topdir);
 > > +	if (err && (err != -EEXIST))
 > > +		return err;
 > > +
 > > +	err = relayfs_create_file(fname, topdir, dentry, data, S_IRUSR);
 > > +
 > > +	return err;
 > > +}
 > 
 > What protects topdir from being removed inbetween?
 > Why is necessary to let the user create/remove files/dirs at all?

Good point - file/dir creation/removal should only be done by
relay_open/close.  I'll make sure to fix both of these things.

[...]

 > 
 > For the first version I would suggest to use just local_irq_save/_restore.
 > Getting it right with local_add_return is not trivial and I'm pretty sure 
 > your relay_switch_buffer() gets it wrong, e.g. the caller for whom (offset 
 > < bufsize) must close the subbuffer. Also buffer->data in relay_reserve 
 > may have become invalid (e.g. by an interrupt just before it).
 > 

Yes, there are a couple of bugs here, but I think they're easily fixed
- thanks for spotting them.

For the buffer->data problem, the value of buffer->data at the time
offset is reserved would have to be saved along with it for it to make
sense.

For relay_switch_buffer(), only the offset of the first event that
didn't fit would be less than bufsize so if there was a check for that
i.e. if offset < bufsize, calculate padding, otherwise don't and just
continue, the interrupt would continue through and actually accomplish
the buffer switch, while the interrupted event would calculate the
padding and then exit immediately because of the (offset + length <
bufsize) recheck.  Both would then loop around again to retry and
succeed.  Well, I'm not sure that explanation is clear, but it seems
like it should work with that small change.

Please let me know if you disagree or see any other problems.

 > You can also move all the rchan_buf members which are not written to in 
 > the event path and which are common to all channels back to rchan.

Yes, I was actually planning on doing that, but hadn't gotten to it
yet.


Thanks,

Tom


      reply	other threads:[~2005-02-01 15:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-28 19:38 Tom Zanussi
2005-01-28 20:48 ` Tim Bird
2005-01-28 22:24 ` Andrew Morton
2005-01-29  8:08 ` Andi Kleen
2005-01-30  4:58   ` Tom Zanussi
2005-01-31 12:57     ` Andi Kleen
2005-01-31 16:26       ` Tom Zanussi
2005-01-31 19:41         ` Karim Yaghmour
2005-01-31 21:03           ` Tom Zanussi
2005-01-31 21:12             ` Karim Yaghmour
2005-01-31 19:38       ` Karim Yaghmour
2005-01-29  8:15 ` Greg KH
2005-01-30  5:02   ` Tom Zanussi
2005-01-31 22:10   ` Karim Yaghmour
2005-01-31 22:33     ` Greg KH
2005-01-31 22:35       ` Karim Yaghmour
2005-01-31 23:12 ` Roman Zippel
2005-02-01 15:44   ` Tom Zanussi [this message]

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=16895.41970.832512.893906@tut.ibm.com \
    --to=zanussi@us.ibm.com \
    --cc=ak@muc.de \
    --cc=akpm@osdl.org \
    --cc=bob@watson.ibm.com \
    --cc=greg@kroah.com \
    --cc=karim@opersys.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tim.bird@AM.SONY.COM \
    --cc=zippel@linux-m68k.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

all inboxes | Powered by JetHome®