lkml.org 
[lkml]   [2007]   [Jul]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 2.4 Q: list of open files per inode?
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.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-07-22 16:39    [W:0.284 / U:0.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site