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

Tao Ma tao.ma at oracle.com
Thu Mar 11 18:14:52 PST 2010


Hi Jiaju,

Jiaju Zhang wrote:
> Hi Tao,
> 
> On Thu, Mar 11, 2010 at 10:18 PM, Tao Ma <tao.ma at oracle.com> wrote:
>> Hi jiaju,
>> Jiaju Zhang wrote:
>>> Hi,
>>>
>>> This is a simple patch which fix the issue that tunefs.ocfs2 online
>>> resize can't handle symbolic link of a device file. For example, in
>>> the LVM using scenario, '/dev/vg1/lv1' and '/dev/mapper/vg1-lv1' are
>>> the same device, '/dev/vg1/lv1' is just a symbolic link to
>>> '/dev/mapper/vg1-lv1'. But if we try to do online resize like
>>> 'tunefs.ocfs2 -S /dev/vg1/lv1', it fails.
>>>
>>> Any review and comments are highly appreciated!
>>>
>>   you said you fixed the bug in tunefs.ocfs2, but the patch is in
>> ocfs2_controld/mount.c? You send the wrong patch?
> 
> No, just this patch :-) My environment is ocfs2 with user-space
> cluster stack enabled. This issue happens only in online resize
> scenario because online resize will call 'ocfs2_initialize_dlm', in
> which the operation joining mountgroup (user_begin_group_join) is
> called.
oh, so it is a ocfs2_initialize_dlm bug actually. I have added Joel to 
CC since he is the original author of ocfs2_controld.

Regards,
Tao
> 
> It is in ocfs2_controld/mount.c is because mount.c not only handles
> what the 'mount' operation should do but also all the operations
> related to mountgroup, others like mkfs.ocfs2, fsck.ocfs2,
> tunefs.ocfs2 are all one type of service in mountgroup.
> 
> This bug just happens when tunefs.ocfs2 wants to join the mountgroup.
> 
> Thanks,
> Jiaju
> 
>> Regards,
>> Tao
>>> Thanks a lot,
>>> Jiaju
>>>
>>> Signed-off-by: Jiaju Zhang <jjzhang.linux at gmail.com>
>>> ---
>>>  ocfs2_controld/mount.c |    4 +++-
>>>  1 files changed, 3 insertions(+), 1 deletions(-)
>>>
>>> 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) {
>>>                fill_error(mg, EINVAL,
>>>                           "Trying to mount fs %s on device %s, but it is
>>> already mounted from device %s",
>>>                           mg->mg_uuid, device, mg->mg_device);
>>>
>>> _______________________________________________
>>> Ocfs2-tools-devel mailing list
>>> Ocfs2-tools-devel at oss.oracle.com
>>> http://oss.oracle.com/mailman/listinfo/ocfs2-tools-devel
>>>
>>



More information about the Ocfs2-tools-devel mailing list