Messages in this thread | | | Date | Sun, 22 Jul 2007 15:35:31 +0100 | From | Al Viro <> | Subject | Re: 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/
| |