All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ftp.linux.org.uk>
To: Jacob Avraham <jacoba51-tmp@yahoo.com>
Cc: "'Jan Engelhardt'" <jengelh@computergmbh.de>,
	linux-kernel@vger.kernel.org
Subject: Re: 2.4 Q: list of open files per inode?
Date: Sun, 22 Jul 2007 15:35:31 +0100	[thread overview]
Message-ID: <20070722143531.GA21668@ftp.linux.org.uk> (raw)
In-Reply-To: Pine.LNX.4.64.0707221506090.15705@fbirervta.pbzchgretzou.qr

On Sun, Jul 22, 2007 at 05:23:22PM +0300, Jacob Avraham wrote:
> > {
> > 	struct mystuff *pd = filp->private_data;
> > 	list_del(&pd->list);
> > 	free(pd);
> > }
> > 
> > Simple as that. *Of course* this requires that the file descriptor remains
> > open. But that should not be a problem, would it?

First of all, that's obviously racy (list manipulations without any
exclusion *or* preventing aforementioned timer running while you do
it).

More important part is that stuff put into your private_data would
better remain valid through the lifetime of opened file.  In particular,
you _can't_ expect that process that had opened the file in question
is still alive.
 
> I ended up implementing my own list (similar to the above), so now the question is more theoretical.
> BTW, does 2.6 has an easy way to get from an inode to all the open fds?

Same situation.

  reply	other threads:[~2007-07-22 14:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-22 12:45 2.4 Q: list of open files per inode? Jacob A
2007-07-22 13:07 ` Jan Engelhardt
2007-07-22 14:35   ` Al Viro [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-07-22 12:26 Jacob A
2007-07-22 12:28 ` Jan Engelhardt
2007-07-22 11:39 Jacob A
2007-07-22 11:58 ` Jan Engelhardt
2007-07-22 12:51 ` Al Viro
2007-07-19  9:01 Jacob A
2007-07-19 11:41 ` Jan Engelhardt
2007-07-19 16:38   ` Al Viro

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=20070722143531.GA21668@ftp.linux.org.uk \
    --to=viro@ftp.linux.org.uk \
    --cc=jacoba51-tmp@yahoo.com \
    --cc=jengelh@computergmbh.de \
    --cc=linux-kernel@vger.kernel.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 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.