Re: CVS commit: src/sys/dev/dm

2014-08-19 Thread Maxime Villard
Le 18/08/2014 19:16, Alistair G. Crooks a écrit :
 
 Module Name:  src
 Committed By: agc
 Date: Mon Aug 18 17:16:42 UTC 2014
 
 Modified Files:
   src/sys/dev/dm: dm_target_stripe.c
 
 Log Message:
 Avoid a memory leak - from maxv
 
 
 To generate a diff of this commit:
 cvs rdiff -u -r1.19 -r1.20 src/sys/dev/dm/dm_target_stripe.c
 
 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.
 
 

I have a doubt for this one.

for (strpi = DM_STRIPE_DEV_OFFSET; strpi  strpc; strpi += 2) {
printf(Stripe target device name %s -- offset %s\n,
   argv[strpi], argv[strpi+1]);

tlc = kmem_alloc(sizeof(*tlc), KM_NOSLEEP);
if ((tlc-pdev = dm_pdev_insert(argv[strpi])) == NULL) {
kmem_free(tsc, sizeof(*tsc));
XXX kmem_free(tlc, sizeof(*tlc));
return ENOENT;
}
tlc-offset = atoi(argv[strpi+1]);

/* Insert striping device to linked list. */
XXX TAILQ_INSERT_TAIL(tsc-stripe_devs, tlc, entries);
}

The tlc's inserted into the list are not freed, are they?



Re: CVS commit: src/sys/dev/dm

2014-08-19 Thread John Nemeth
On Aug 19,  6:50am, Maxime Villard wrote:
} Le 18/08/2014 19:16, Alistair G. Crooks a écrit :
}  
}  Module Name:src
}  Committed By:   agc
}  Date:   Mon Aug 18 17:16:42 UTC 2014
}  
}  Modified Files:
}  src/sys/dev/dm: dm_target_stripe.c
}  
}  Log Message:
}  Avoid a memory leak - from maxv
}  
}  To generate a diff of this commit:
}  cvs rdiff -u -r1.19 -r1.20 src/sys/dev/dm/dm_target_stripe.c
} 
} I have a doubt for this one.
} 
}   for (strpi = DM_STRIPE_DEV_OFFSET; strpi  strpc; strpi += 2) {
}   printf(Stripe target device name %s -- offset %s\n,
}  argv[strpi], argv[strpi+1]);
} 
}   tlc = kmem_alloc(sizeof(*tlc), KM_NOSLEEP);
}   if ((tlc-pdev = dm_pdev_insert(argv[strpi])) == NULL) {
}   kmem_free(tsc, sizeof(*tsc));
} XXX   kmem_free(tlc, sizeof(*tlc));
}   return ENOENT;
}   }
}   tlc-offset = atoi(argv[strpi+1]);
} 
}   /* Insert striping device to linked list. */
} XXX   TAILQ_INSERT_TAIL(tsc-stripe_devs, tlc, entries);
}   }
} 
} The tlc's inserted into the list are not freed, are they?

 Notice the return ENOENT after the two calls to kmem_free().
If the first XXX line is executed then the second XXX line won't be.

}-- End of excerpt from Maxime Villard


Re: CVS commit: src/sys/dev/dm

2014-08-19 Thread Maxime Villard
Le 19/08/2014 10:31, John Nemeth a écrit :
 On Aug 19,  6:50am, Maxime Villard wrote:
 } Le 18/08/2014 19:16, Alistair G. Crooks a écrit :
 }  
 }  Module Name:  src
 }  Committed By: agc
 }  Date: Mon Aug 18 17:16:42 UTC 2014
 }  
 }  Modified Files:
 }src/sys/dev/dm: dm_target_stripe.c
 }  
 }  Log Message:
 }  Avoid a memory leak - from maxv
 }  
 }  To generate a diff of this commit:
 }  cvs rdiff -u -r1.19 -r1.20 src/sys/dev/dm/dm_target_stripe.c
 } 
 } I have a doubt for this one.
 } 
 } for (strpi = DM_STRIPE_DEV_OFFSET; strpi  strpc; strpi += 2) {
 } printf(Stripe target device name %s -- offset %s\n,
 }argv[strpi], argv[strpi+1]);
 } 
 } tlc = kmem_alloc(sizeof(*tlc), KM_NOSLEEP);
 } if ((tlc-pdev = dm_pdev_insert(argv[strpi])) == NULL) {
 } kmem_free(tsc, sizeof(*tsc));
 } XXX kmem_free(tlc, sizeof(*tlc));
 } return ENOENT;
 } }
 } tlc-offset = atoi(argv[strpi+1]);
 } 
 } /* Insert striping device to linked list. */
 } XXX TAILQ_INSERT_TAIL(tsc-stripe_devs, tlc, entries);
 } }
 } 
 } The tlc's inserted into the list are not freed, are they?
 
  Notice the return ENOENT after the two calls to kmem_free().
 If the first XXX line is executed then the second XXX line won't be.

Yes, but that's a loop. The second XXX line may be reached several times,
before the first one returns ENOENT. And on that case the tlc's previously
allocated are not freed.

Unless I'm not reading clearly?




Re: CVS commit: src/sys/dev/dm

2010-05-18 Thread Matthias Scheler
On Tue, May 18, 2010 at 03:10:41PM +, Adam Hamsik wrote:
 Log Message:
 Add support for DIOCCACHESYNC ioctl for dm devices. Add new sync function
 pointer to dm_target_t because that is the only part of dm which know real
 block device. disk_ioctl_switch parses whole device table and for every
 entry it calls particular sync routine which propagates DIOCCACHESYNC
 to real disk.

What happens if a logical volume consists of two slice of one physical
device? Will the physical device get flushed twice?

Kind regards

-- 
Matthias Scheler  http://zhadum.org.uk/


Re: CVS commit: src/sys/dev/dm

2010-05-18 Thread Adam Hamsik

On May,Tuesday 18 2010, at 5:42 PM, Matthias Scheler wrote:

 On Tue, May 18, 2010 at 03:10:41PM +, Adam Hamsik wrote:
 Log Message:
 Add support for DIOCCACHESYNC ioctl for dm devices. Add new sync function
 pointer to dm_target_t because that is the only part of dm which know real
 block device. disk_ioctl_switch parses whole device table and for every
 entry it calls particular sync routine which propagates DIOCCACHESYNC
 to real disk.
 
 What happens if a logical volume consists of two slice of one physical
 device? Will the physical device get flushed twice?

Yes and there is no easy way how to not do that.

Regards

Adam.



Re: CVS commit: src/sys/dev/dm

2010-03-24 Thread Adam Hamsik

On Mar,Tuesday 23 2010, at 4:09 PM, Jonathan A. Kollasch wrote:

 Module Name:  src
 Committed By: jakllsch
 Date: Tue Mar 23 15:09:45 UTC 2010
 
 Modified Files:
   src/sys/dev/dm: device-mapper.c
 
 Log Message:
 Rework module/builtin code so it works in both cases.
 (Tested recently in the module case, slightly less recently as builtin.)
 
 haad [if it works] go for it
 

now when we have built in case working, would you like to add pseudo-device dm 
to AMD64, i386 non-modular kernels ? I think that 

ALL
MONOLITHIC
*XEN*

should be enough. What do you think about this ?(Sorry I have zero free time 
now, otherwise I would do it myself:()

Regards

Adam.