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

Re: [libvirt] [PATCH 1 of 3] [LXC] Add functions to manage veth device pairs



>> +#define DEBUG(fmt,...) VIR_DEBUG(__FILE__, fmt, __VA_ARGS__)
>> +#define DEBUG0(msg) VIR_DEBUG(__FILE__, "%s", msg)

DL> Do you know ##__VA_ARGS ?

Yes, and I agree this not my preferred way.  However, this isn't my
code and when I went to look for other instances, I found many so I
decided not to change it.

  % cat *.c | grep DEBUG0 -c
  47

DL> Is this function safe for concurrent access ? eg. getFreeVethName
DL> called in parallel by two processes or another process creates a
DL> pair device just after you exit the loop ?

No, there is indeed a race.  However, since this just makes a
suggestion and relies on the subsequent call to try to instantiate the
interface, I don't think there's a chance for anything other than a
spurious failure.

This is specifically why I wanted to get this on the list sooner than
later.  I figured (or hoped) that given the experience in this group
that someone could offer some educated suggestions before I jumped in
and started trying to fix it.

>> +    if (1 > strlen(veth1)) {

DL> Why do you check with strlen > 1 ?

To be honest, I have no idea why Dave did that.  I'll check with him
to see if there's something we're missing.  It's probably worth a
comment if so.

-- 
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms us ibm com

Attachment: pgp1K0Gn3vmPI.pgp
Description: PGP signature


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