1 #!/bin/sh /usr/share/dpatch/dpatch-run
2 ## 067_allow_disabling_bind_mounts.dpatch
8 diff -Naur .B/modules/mount_bind.c .A/modules/mount_bind.c
9 --- .B/modules/mount_bind.c 2005-01-10 13:28:29.000000000 +0000
10 +++ .A/modules/mount_bind.c 2007-01-07 21:36:35.000000000 +0000
12 if (options == NULL || *options == '\0')
16 + if (bind_works && strcmp(options, "symlink") != 0) {
17 int status, existed = 1;
19 debug(MODPREFIX "calling mkdir_path %s", fullpath);
20 diff -Naur .B/modules/mount_nfs.c .A/modules/mount_nfs.c
21 --- .B/modules/mount_nfs.c 2007-01-07 21:36:35.000000000 +0000
22 +++ .A/modules/mount_nfs.c 2007-01-07 21:36:35.000000000 +0000
25 char *nfsoptions = NULL;
28 + int nosymlink = 0; /* Actually misnamed, should be "nobind" now */
29 + int symlink = 0; /* Prefer symlinks to bind mounts? */
30 int ro = 0; /* Set if mount bind should be read-only */
32 debug(MODPREFIX "root=%s name=%s what=%s, fstype=%s, options=%s",
34 strcpy(whatstr, what);
36 /* Extract "nosymlink" pseudo-option which stops local filesystems
37 - from being symlinked */
38 + from being bind mounted, and "symlink" pseudo-option which does not
39 + do the exact opposite, but rather makes any bind mount into a
40 + symlink instead. (Both nosymlink and symlink at the same time
41 + make no sense, of course.) */
47 if (strncmp("nosymlink", cp, end - cp + 1) == 0)
49 + else if (strncmp("symlink", cp, end - cp + 1) == 0)
52 /* Check for options that also make sense
58 - debug(MODPREFIX "nfs options=\"%s\", nosymlink=%d, ro=%d",
59 - nfsoptions, nosymlink, ro);
60 + debug(MODPREFIX "nfs options=\"%s\", nosymlink=%d, symlink=%d, ro=%d",
61 + nfsoptions, nosymlink, symlink, ro);
67 /* Local host -- do a "bind" */
69 - const char *bind_options = ro ? "ro" : "";
70 + const char *bind_options;
72 + bind_options = "symlink";
74 + bind_options = ro ? "ro" : "";
76 debug(MODPREFIX "%s is local, doing bind", name);