diff options
author | Edward Shishkin <edward@redhat.com> | 2009-12-15 18:47:47 +0100 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2010-04-20 09:51:52 +0200 |
commit | 4b747a4016573e7f2510b6ab767783a2708d1e55 (patch) | |
tree | a91415b4cb1a7b857ab8d71c88392398f4a7248f | |
parent | 014b0ea19762341e217d463308710c3662d50e9c (diff) | |
download | blktrace-4b747a4016573e7f2510b6ab767783a2708d1e55.tar.gz |
blktrace: avoid device duplication
Fixup for bz 501457.
Problem:
If the device list file contains the same device
as supplied on the command line, blktrace stops
immediately and further I/O tracing is impossible.
Bug: device duplication in the devpaths ends with
programm termination (BLKTRACESETUP ioctl returns
error) while resources (open files in debugfs) are
not released.
Solution:
Make sure devices are not duplicated in devpaths
pool.
Signed-off-by: Edward Shishkin <edward@redhat.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r-- | blktrace.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -1200,8 +1200,17 @@ static int add_devpath(char *path) { int fd; struct devpath *dpp; + struct list_head *p; /* + * Verify device is not duplicated + */ + __list_for_each(p, &devpaths) { + struct devpath *tmp = list_entry(p, struct devpath, head); + if (!strcmp(tmp->path, path)) + return 0; + } + /* * Verify device is valid before going too far */ fd = my_open(path, O_RDONLY | O_NONBLOCK); |