> I think if we are in __do_close(p->files, fd, 1) and the process 'p' is
> inside, for example, sys_close(fd, 1) which called do_close(), it will
Huh??? Since when did close(2) get the
second argument???
> have troubles. What troubles? Well, if the check for EBADF possibility
> has been done then we will be releasing resources twice - certainly not
> right. Do you agree with this?
Not. ->file_lock protects you against it.
> Therefore, I mentioned a possibility of adding a rw semaphore to struct
> file, which would be taken read in fget and write in do_close. I am not
> 100% sure this will work. Do you have a better idea?
Yes. E.g. recalling that files_struct may be shared between processes, so
there is nothing special about your case.
Why do you want to do that? There are many other users of struct file and
many of them can't be convinced to disappear that easily. If that's a part
of your revoke() stuff - well, I think you are on a very wrong path.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/