inode: correct close behaviour for devices (note: impacts some drivers!)
authorAlan Cox <alan@linux.intel.com>
Thu, 21 May 2015 22:44:38 +0000 (23:44 +0100)
committerAlan Cox <alan@linux.intel.com>
Thu, 21 May 2015 22:44:38 +0000 (23:44 +0100)
We should call _close for each close matching the final close of an open.
This is a slight change in semantics but it's what we actually need to sort
must things out.

Yes it breaks some devices..diddums 8)

Kernel/inode.c

index 1fb217d..c0c7a79 100644 (file)
@@ -223,7 +223,7 @@ int16_t doclose(uint8_t uindex)
 
        oftindex = udata.u_files[uindex];
 
-       if (ino->c_refs == 1 && of_tab[oftindex].o_refs == 1) {
+       if (of_tab[oftindex].o_refs == 1) {
                if (isdevice(ino))
                        d_close((int) (ino->c_node.i_addr[0]));
                if (getmode(ino) == F_REG && O_ACCMODE(of_tab[oftindex].o_access))