i_writecount doubt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



182  if (file) {
183  struct inode *inode = file->f_dentry->d_inode;
184  get_file(file);
185  if (tmp->vm_flags & VM_DENYWRITE)
186  atomic_dec(&inode->i_writecount);
187

  I was looking at the code of dup_mmap() in fork.c. I didnt understand
something over here. The code above is checking whether the vm_area of the
parent that the new process (child process)is copying, has read-only
permission or read-write
permission. If it has read-only permission then the inode's i_writecount
is decremented. I saw in the vm documentation that if i_writecount is
negative then it is read-only and if it is positive then it is positive.
According to my understanding the inode data that we are accessing is
global. So some processes might have read-only access
to the file and some have read-write access to the file. So how can we
decide whether the process has the correct access just by seeing the value
of i_writecount of the inode. OR am i missing something over here.

  Can anyone please explain whats happening over here.

 thanks,
raghu
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux