All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Pekka J Enberg <penberg@cs.helsinki.fi>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] revoke: change revoke_table to fileset and revoke_details
Date: Thu, 3 May 2007 17:04:47 -0700	[thread overview]
Message-ID: <20070503170447.8520da9c.akpm@linux-foundation.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0705032329220.14781@sbz-30.cs.Helsinki.FI>

On Thu, 3 May 2007 23:32:28 +0300 (EEST)
Pekka J Enberg <penberg@cs.helsinki.fi> wrote:

> On Thu, 3 May 2007, Andrew Morton wrote:
> > > +/**
> > > + * fileset - an array of file pointers.
> > > + * @files:    the array of file pointers
> > > + * @nr:               number of elements in the array
> > > + * @end:      index to next unused file pointer
> > > + */
> > > +struct fileset {
> > > +	struct file	**files;
> > > +	unsigned long	nr;
> > > +	unsigned long	end;
> > > +};
> > 
> > What's the locking protocol for all this?
> 
> What do you mean? There is no concurrent access going on here.

Well that's the "locking" protocol then: each instance of this structure is
only ever touched by a single thread, yes?

> On Thu, 3 May 2007, Andrew Morton wrote:
> > > +static void free_fset(struct fileset *fset)
> > > +{
> > > +      int i;
> > > +
> > > +      for (i = fset->end; i < fset->nr; i++)
> > > +              fput(fset->files[i]);
> > > +
> > > +      kfree(fset->files);
> > > +      kfree(fset);
> > > +}
> > 
> > Confused.  Shouldn't it be
> > 
> > 	for (i = 0; i < fset->end; i++)
> 
> No. The fset->end is an index to the first _unused_ file pointer. All 
> entries before that are in use by revoked file descriptors so we don't 
> want to fput() them.
> 

OK.

  reply	other threads:[~2007-05-04  0:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-03 14:53 [PATCH 2/2] revoke: change revoke_table to fileset and revoke_details Pekka J Enberg
2007-05-03 20:22 ` Andrew Morton
2007-05-03 20:32   ` Pekka J Enberg
2007-05-04  0:04     ` Andrew Morton [this message]
2007-05-04  6:13       ` Pekka J Enberg

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=20070503170447.8520da9c.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penberg@cs.helsinki.fi \
    /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.