I'm using Redhat 2.4.20-8 kernel. We are developing a new policy based file system. In that, when one file gets deleted, I have to delete one more file other than the one which is going to get deleted. Since we didn't want to use sys_unlink from our system for the second file, we chose to do it from userspace. When the original file (by this, I mean the file which gets the delete originally) deletion is in process, I would spawn a thread which in turn will call unlink (second file). But I couldn't succeed. The unlink which is instigated from the thread always gets -EPERM even though the first file gets deleted. sys_unlink gets called and then after lookup it gives back EPERM.
Any help on this would be really appreciated.