From 0ae8dceaebe3659ee0c3352c08125f403e77ebca Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Tue, 28 Sep 1999 22:25:29 +0000 Subject: Merge with 2.3.10. --- fs/namei.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'fs/namei.c') diff --git a/fs/namei.c b/fs/namei.c index 9769ce1bb..e39cd24e1 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -171,18 +171,22 @@ int permission(struct inode * inode,int mask) * 0: no writers, no VM_DENYWRITE mappings * < 0: (-i_writecount) vm_area_structs with VM_DENYWRITE set exist * > 0: (i_writecount) users are writing to the file. + * + * WARNING: as soon as we will move get_write_access(), do_mmap() or + * prepare_binfmt() out of the big lock we will need a spinlock protecting + * the checks in all 3. For the time being it is not needed. */ int get_write_access(struct inode * inode) { - if (inode->i_writecount < 0) + if (atomic_read(&inode->i_writecount) < 0) return -ETXTBSY; - inode->i_writecount++; + atomic_inc(&inode->i_writecount); return 0; } void put_write_access(struct inode * inode) { - inode->i_writecount--; + atomic_dec(&inode->i_writecount); } /* -- cgit v1.2.3