inode: fix ref counts from recent ref change
authorAlan Cox <alan@linux.intel.com>
Mon, 29 Aug 2016 11:33:10 +0000 (12:33 +0100)
committerAlan Cox <alan@linux.intel.com>
Mon, 29 Aug 2016 11:33:10 +0000 (12:33 +0100)
Kernel/inode.c

index 84cf696..5c1b446 100644 (file)
@@ -257,16 +257,15 @@ int16_t doclose(uint8_t uindex)
                if (issocket(ino))
                        sock_close(ino);
 #endif
+               if (m != O_RDONLY)
+                       ino->c_writers--;
+               if (m != O_WRONLY)
+                       ino->c_readers--;
        }
        udata.u_files[uindex] = NO_FILE;
        udata.u_cloexec &= ~(1 << uindex);
        oft_deref(oftindex);
 
-       if (m != O_RDONLY)
-               ino->c_writers--;
-        if (m != O_WRONLY)
-                ino->c_readers--;
-
        /* if we closed a file in write mode, flush the device's cache after inode has been deferenced */
        if(flush_dev != NO_DEVICE)
                d_flush(flush_dev);