linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
To: Joel Becker <Joel.Becker@oracle.com>
Cc: Konrad Rzeszutek Wilk <konrad@darnok.org>,
	linux-scsi <linux-scsi@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
	Mike Christie <michaelc@cs.wisc.edu>,
	Christoph Hellwig <hch@lst.de>, Hannes Reinecke <hare@suse.de>,
	James Bottomley <James.Bottomley@suse.de>,
	Jens Axboe <axboe@kernel.dk>, Boaz Harrosh <bharrosh@panasas.com>,
	Linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [RFC 02/22] configfs: Add struct configfs_item_operations->check_link() in configfs_unlink()
Date: Fri, 10 Sep 2010 12:06:46 -0700	[thread overview]
Message-ID: <1284145606.19890.68.camel@haakon2.linux-iscsi.org> (raw)
In-Reply-To: <20100910152802.GG885@mail.oracle.com>

On Fri, 2010-09-10 at 08:28 -0700, Joel Becker wrote:
> On Wed, Sep 08, 2010 at 01:53:27PM -0700, Nicholas A. Bellinger wrote:
> > On Wed, 2010-09-08 at 12:26 -0700, Joel Becker wrote:
> > So after re-running this again, I was a bit off about where the OOOPs is
> > actually occuring.  So, the OOPs does not occur during in the simple
> > example here with the first unlink(2):
> > 
> > 	unlink sub_child/group1/src_0/src_link
> > 
> > but rather after the second unlink(2) is called after the first for
> > src_link occurs:
> > 
> > 	unlink sub_child/group2/dst_0/dst_link
> > 
> > So back to the OOPs with the current TCM code example, on v2.6.36-rc3
> > this actually triggers a SLUB warning "Object already free" from inside
> > of TCM code. This is attributed to the releasing a specific LUN ACLs
> > from the second unlink(2)'s struct config_item_operations->drop_link(),
> > that the first unlink had already released.  This is because the first
> > unlink(2) will currently assume that the remaining LUN ACLs are safe to
> > release because, it still assumes the disabled check_link call.
> 
> 	The trivial solution is to refcount your ACLs.  You get both
> allow_link() calls, so you should be able to increment a counter there,
> and then drop them when the last drop_link() call is made.  That will
> keep your consumer structures around until all links are exhausted.
> 

Hi Joel,

So I am a bit confused wrt to this last response..  The ->check_link()
patch and it's use in the fabric independent code within
target_core_fabric_configfs.c does exactly this for the 'MappedLUN'
symlink case, eg: requires the consumer to do the allow_link() +
drop_link() refcounting, and add the
API check into fs/configfs/symlink.c:configfs_unlink()

Is there another form of configfs consumer refcounting that you had in
mind beyond using an atomic_t for this with ->check_link() here..?

http://git.kernel.org/?p=linux/kernel/git/nab/lio-core-2.6.git;a=blob;f=drivers/target/target_core_fabric_configfs.c;hb=refs/heads/lio-4.0#l675

So beyond a configfs consumer solution, what do you think about checking
for the sub_child/group2/dst_0/dst_link style of symlink
in fs/configfs/symlink.c:configfs_symlink() in order to add some form of
internal refcount when the symlink source is within the same consumer
LKM, but outside of the parent struct config_group..?

This would involve the conversion of fs/configfs/symlink.c:
configfs_unlink() path to check for the existence of this internal
refcount and returning -EPERM when any sub_child/group2/dst_0/dst_link
exist when 'unlink sub_child/group1/src_0/src_link' is attempted.

What do you think..?

Thanks!

--nab


  reply	other threads:[~2010-09-10 19:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1283160025-6598-1-git-send-email-nab@linux-iscsi.org>
     [not found] ` <201009020031.08750.konrad@darnok.org>
     [not found]   ` <20100902064814.GB27904@mail.oracle.com>
2010-09-02 19:40     ` [RFC 02/22] configfs: Add struct configfs_item_operations->check_link() in configfs_unlink() Nicholas A. Bellinger
2010-09-07 21:01       ` Konrad Rzeszutek Wilk
2010-09-07 22:44         ` Joel Becker
2010-09-08  2:08           ` Nicholas A. Bellinger
2010-09-08 19:26             ` Joel Becker
2010-09-08 20:53               ` Nicholas A. Bellinger
2010-09-10 15:28                 ` Joel Becker
2010-09-10 19:06                   ` Nicholas A. Bellinger [this message]
2010-09-10 19:44                     ` Joel Becker
2010-09-10 19:52                       ` Nicholas A. Bellinger
2010-09-20 22:06                         ` Joel Becker
2010-09-22  7:16                           ` Nicholas A. Bellinger
2010-09-22 11:18                             ` Boaz Harrosh
2010-09-22 11:54                               ` Nicholas A. Bellinger
2010-09-23  3:59                             ` Joel Becker

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=1284145606.19890.68.camel@haakon2.linux-iscsi.org \
    --to=nab@linux-iscsi.org \
    --cc=James.Bottomley@suse.de \
    --cc=Joel.Becker@oracle.com \
    --cc=axboe@kernel.dk \
    --cc=bharrosh@panasas.com \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=konrad@darnok.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=michaelc@cs.wisc.edu \
    /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).