If blk_trace->dir isn't same with .debugfs_dir, you will just renameThank you for your response!
blk_trace->dir, this way can't avoid the failure in step3, can it?
To avoid the race, I think we can take the lock 'blk_trace_mutex' while
I understand that we just need to rename .debugfs_dir, meantime making
sure blktrace code removes correct debugfs dir, is that enough for fixing
this issue?
+ if (old == NULL)The above code can be run concurrently with blktrace shutdown, so race might
+ return;
+ while (new == NULL) {
+ sprintf(name, "ready_to_remove_%s_%d",
+ kobject_name(q->kobj.parent), i++);
+ new = debugfs_rename(blk_debugfs_root, *old,
+ blk_debugfs_root, name);
+ }
exit between the two code paths, then bt->dir may has been renamed or being
renamed in debugfs_remove(bt->dir), can this function work as expected or
correct?
The deap loop will exist if 'debugfs_rename' keep failing for some
And there is dead loop risk, so suggest to not rename this way.