All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Timothy Shimmin <tes@sgi.com>
Cc: xfs-oss <xfs@oss.sgi.com>
Subject: Re: [PATCH] use generic_*xattr routines
Date: Fri, 30 May 2008 09:53:11 +0200	[thread overview]
Message-ID: <20080530075310.GA8446@lst.de> (raw)
In-Reply-To: <483FA0B6.1030703@sgi.com>

On Fri, May 30, 2008 at 04:37:42PM +1000, Timothy Shimmin wrote:
> > Yes.  I have an initial patch that goes directly to xfs_attr_list_int
> > from xfs_xattr.c and kills most of the ATTR_KERN flags.  It's a quite
> > nice cleanup already.  Next step will be to convert dmapi to use it's
> > own callback aswell.  This will be an even bigger cleanup as
> > put_listent gets the xattr value aswell and we can kill the additional
> > xfs_attr_get calls, making this code simpler and more efficient.
> > 
> Sorry, what xfs_attr_get call are you referring to?

xfs_dm_getall_dmattr currently does an xfs_attr_list and then performs
and xfs_attr_get for each attribute it cares about.  But rewriting this
to use put_listent we not only get rid of the temporary buffer but
also the need to calls xfs_attr_get because put_listent already gets
the attribute value passed.  It also fixes the race mentioned in the
comment and with a properly written put_listent helper can copy the
attributes directly to userspace without any kernel buffer at all.

That would also fix the direct userspace pointer dereference currently
lingering in that code :)

> > I've started looking at this and after some investigation I think
> > we should just pass the xfs_inode directly to all the functions and then
> > a void parameter, yes.  We'll need to find a solution for the
> > seen_enough paramter, but I think this could be handled similar to
> > filldir.  There's also some functions directly touching the attr cursor
> > which seems solveable, too.
> > 
> I'll await the patch :)
> The seen_enough param was added for search type callbacks so the callback
> could terminate the list walk early.
> Oh okay, I also used it to stop when we fill the buffer.

Yes. May idea is to break out of the loop as soon as put_listent returns
a non-zero value just like filldir.  We can then decided to play with
positivie / begative values to allow for a sucessfull early exit, or
just like filldir have the actual errno inside the private context
structure.  I suspect the first variant will be cleaner.

      reply	other threads:[~2008-05-30  7:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-30 11:22 [PATCH] use generic_*xattr routines Christoph Hellwig
2008-05-21  8:16 ` Christoph Hellwig
2008-05-22  7:17   ` Timothy Shimmin
2008-05-23  5:22   ` Timothy Shimmin
2008-05-23  5:48     ` Christoph Hellwig
2008-05-26  1:43       ` Timothy Shimmin
2008-05-26  5:37         ` Christoph Hellwig
2008-05-27 10:50           ` Timothy Shimmin
2008-05-29 12:39             ` Christoph Hellwig
2008-05-30  6:37               ` Timothy Shimmin
2008-05-30  7:53                 ` Christoph Hellwig [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=20080530075310.GA8446@lst.de \
    --to=hch@lst.de \
    --cc=tes@sgi.com \
    --cc=xfs@oss.sgi.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.