Fix resource leak in the STREAM_CLOSE path. io-streamid
authorAndrzej Jakowski <andrzej.jakowski@intel.com>
Wed, 27 Jul 2016 19:17:24 +0000 (12:17 -0700)
committerJens Axboe <axboe@fb.com>
Wed, 27 Jul 2016 19:32:35 +0000 (13:32 -0600)
Allocated stream identifier (alloc_id) nor closed stream_id has never
been deallocated in the STREAM_CLOSE path, causing issues when closed
stream was reopened again. This patch fixes that problem.

Signed-off-by: Andrzej Jakowski <andrzej.jakowski@intel.com>
Signed-off-by: Kapil Karkra <kapil.karkra@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
fs/read_write.c

index 7218d69b17633120c7fd498c185219687dee43d2..6ad3dc5cea4d6126571d3059390dfdf4a47f8b9c 100644 (file)
@@ -1737,6 +1737,8 @@ SYSCALL_DEFINE4(streamid, int, fd, int, cmd,
                        inode->i_streamid = 0;
                        spin_unlock(&inode->i_lock);
                }
+               bdi_streamid(f.file->f_mapping->host, STREAMID_CLOSE, alloc_id);
+               bdi_streamid(f.file->f_mapping->host, STREAMID_CLOSE, streamid);
        }
 
 done: