[Ocfs2-tools-devel] [PATCH] Improvement to tunefs.ocfs2 online resize to handle symbolic link

Jiaju Zhang jjzhang.linux at gmail.com
Thu Mar 11 17:59:42 PST 2010


On Fri, Mar 12, 2010 at 12:49 AM, Coly Li <coly.li at suse.de> wrote:
>
>
> On 2010年03月11日 17:31, Jiaju Zhang Wrote:
> [snip]
>>
>> diff --git a/ocfs2_controld/mount.c b/ocfs2_controld/mount.c
>> index 36459d1..076f727 100644
>> --- a/ocfs2_controld/mount.c
>> +++ b/ocfs2_controld/mount.c
>> @@ -260,11 +260,13 @@ static void add_service(struct mountgroup *mg, const char *device,
>>                          const char *service, int ci, int fd)
>>  {
>>       struct service *ms;
>> +     struct stat st1, st2;
>>
>>       log_debug("Adding service %s to device %s uuid %s",
>>                 service, device, mg->mg_uuid);
>>
>> -     if (strcmp(mg->mg_device, device)) {
>> +     if (!stat(mg->mg_device, &st1) && !stat(device, &st2)
>> +         && st1.st_rdev != st2.st_rdev) {
>
>  Are mg->mg_device and device from identical node ? If not, there might be chance st1.st_rdev != st2.st_rdev. Is it
> possible just using the target path string which the symbolic link points to (e.g something we get from readlink(2)) ?

Yes, mg->mg_device and device are from identical node.
In my understanding, the original code is to avoid the identical ocfs2
volume being mounted on the same node twice (e.g. in multipath
environment, the same node, the same target ocfs2 volume, but
different path shows different device. There is possibility that the
ocfs2 volume being mounted from different device several times, this
scenario is what we should avoid.)

Thanks for your review and comments ;-)
Jiaju



More information about the Ocfs2-tools-devel mailing list