loopback device can't act as its backing store
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 4 lines · Andrew Morton
+ /* Avoid recursion */
+ f = file;
+ while (is_loop_device(f)) {
+ structloop_device*l;
Quoted 9 lines
+
+ if (f->f_mapping->host==lo_file->f_mapping->host) + gotoout_putf;
+ l =f->f_mapping->host->i_bdev->bd_disk->private_data; + if (l->lo_state==Lo_unbound)
+ break;
+ f =l->lo_backing_file;
+ }
This seems wrong to me. AFAI can see, this does not address
1) a->b->c->b->... (Maybe it' is catched later after some recursions)
2) the max. recursion problem you mentioned. (Maybe it's catched by not having enough loop devices and catching (1), but this may change)
I think the real fix is something like: (guess from this patch, untested)
f = file;
i = MAX_LOOP_CHAIN;
while (is_loop_device(f)) {
struct loop_device *l;/* if MAX_LOOP_CHAIN is high, leaving in the old check might be a nice
shortcut for the common case. Is it?
*/
if(!--i) goto out_putf;
/* off by one? I don't think so, but check it 'cause it's late. */
l = f->f_mapping->host->i_bdev->bd_disk->private_data;
if (l->lo_state == Lo_unbound)
break;/* shouldn't we generate an error instead?
I guess the error will be generated while recursing, but we just followed the chain and know the result.
*/
f = l->lo_backing_file; }