[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] [PATCH] mkfs: wipefs before we mkfs



On 02/17/2012 05:45 PM, Richard W.M. Jones wrote:

> On Thu, Feb 16, 2012 at 05:59:24PM +0800, Wanlong Gao wrote:
>> we wipe the filesystem signatures from device before do mkfs,
>> since we can't trust mkfs can remove the filesystem signature absolutely.
>>
>> Signed-off-by: Wanlong Gao <gaowanlong cn fujitsu com>
>> ---
>>  daemon/mkfs.c |    9 +++++++++
>>  1 files changed, 9 insertions(+), 0 deletions(-)
>>
>> diff --git a/daemon/mkfs.c b/daemon/mkfs.c
>> index 5475582..19224ec 100644
>> --- a/daemon/mkfs.c
>> +++ b/daemon/mkfs.c
>> @@ -181,6 +181,15 @@ do_mkfs_opts (const char *fstype, const char *device, int blocksize,
>>    ADD_ARG (argv, i, device);
>>    ADD_ARG (argv, i, NULL);
>>  
>> +  /* we wipe the filesystem signatures from device before do mkfs,
>> +   * since we can't trust mkfs can remove the filesystem signature absolutely.
>> +   */
>> +  if (do_wipefs (device)) {
> 
> You should test do_wipefs () == -1 here.
> 
>> +    reply_with_error ("%s: %s: %s", fstype, device, err);
> 
> Calling reply_with_error will cause an error to be sent twice (once
> from do_wipefs, once here), and you'll lose protocol synchronization.
> 
> In any case, I'm doubtful that this patch is useful.  If callers want
> to wipe the filesystem before doing mkfs, they can just call wipefs
> themselves.  It sounds like this will just slow down mkfs and make it
> more likely to fail.


Hmm..... yeah, if people wanna wipe the filesystem before doing mkfs,
they can call wipefs themselves.
We can't do any thing for users. ;)

Agree~! :-)

Thanks
-Wanlong Gao

> 
> Rich.
> 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]