Hi Stanislav, I've looked more into it and I found some issues with the patch: Stanislav Brabec writes: > + while ((c = *subpath++)) ^^^ subpath is always post-incremented > + { > + if (c == '/') { > + if (!last_is_slash) { > + component_no++; > + if (component_no == 3) > + break; ^^^ when we break subpath actually 1 past the / > + } > + last_is_slash = true; > + } else > + last_is_slash = false; > + } > + if (component_no == 3) { > + int subpath_len = strlen(subpath); > + if (strncmp(root, subpath, subpath_len)) { ^^^ ^^^ hence why here with //localhost/share/dir in fstab we never get here p root => $1 = 0x7f28aa9977d0 "/dir" p subpath => $2 = 0x7f28aa9979a2 "dir" > + if (*(root + subpath_len + 1) == 0) > + return "/"; > + return root + subpath_len + 1; > + } > + } > + DBG(FS, ul_debugobj(fs, "cifs: leading part of root \"%s\" does > not equal to mounted source subdir \"%s\"; should not happen", root, > src)); ^^^ this message gets printed with //localhost/share //localhost/share/ That being said, I could not make your patch fail i.e. make mount -a mount the fs twice. So I'm not sure what happens there... I thought I would give it a try. I'm attaching a simpler patch that makes uses of streq_paths() in lib/strutils.c (Note: streq_paths() and next_path_segment() have to be backported for older versions of util-linux).