Print this page
6198 Let's EOL cachefs

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/fs.d/autofs/autod_nfs.c
          +++ new/usr/src/cmd/fs.d/autofs/autod_nfs.c
↓ open down ↓ 89 lines elided ↑ open up ↑
  90   90  #include "smfcfg.h"
  91   91  
  92   92  extern void set_nfsv4_ephemeral_mount_to(void);
  93   93  
  94   94  extern char *nfs_get_qop_name();
  95   95  extern AUTH *nfs_create_ah();
  96   96  extern enum snego_stat nfs_sec_nego();
  97   97  
  98   98  #define MAXHOSTS        512
  99   99  
 100      -#define MNTTYPE_CACHEFS "cachefs"
 101      -
 102  100  /*
 103  101   * host cache states
 104  102   */
 105  103  #define NOHOST          0
 106  104  #define GOODHOST        1
 107  105  #define DEADHOST        2
 108  106  
 109  107  #define NFS_ARGS_EXTB_secdata(args, secdata) \
 110  108          { (args).nfs_args_ext = NFS_ARGS_EXTB, \
 111  109          (args).nfs_ext_u.nfs_extB.secdata = secdata; }
↓ open down ↓ 12 lines elided ↑ open up ↑
 124  122          int sec_opt;
 125  123          bool_t snego_done;
 126  124          char *nfs_flavor;
 127  125          seconfig_t nfs_sec;
 128  126  };
 129  127  typedef struct mfs_snego_t mfs_snego_t;
 130  128  
 131  129  static struct cache_entry *cache_head = NULL;
 132  130  rwlock_t cache_lock;    /* protect the cache chain */
 133  131  
 134      -static enum nfsstat nfsmount(struct mapfs *, char *, char *, int, int, uid_t,
      132 +static enum nfsstat nfsmount(struct mapfs *, char *, char *, int, uid_t,
 135  133          action_list *);
 136  134  static int is_nfs_port(char *);
 137  135  
 138  136  static void netbuf_free(struct netbuf *);
 139  137  static int get_pathconf(CLIENT *, char *, char *, struct pathcnf **, int);
 140  138  static struct mapfs *enum_servers(struct mapent *, char *);
 141  139  static struct mapfs *get_mysubnet_servers(struct mapfs *);
 142  140  static int subnet_test(int af, struct sioc_addrreq *);
 143  141  static  struct  netbuf *get_addr(char *, rpcprog_t, rpcvers_t,
 144  142          struct netconfig **, char *, ushort_t, struct t_info *);
↓ open down ↓ 84 lines elided ↑ open up ↑
 229  227  mount_nfs(
 230  228          struct mapent *me,
 231  229          char *mntpnt,
 232  230          char *prevhost,
 233  231          int overlay,
 234  232          uid_t uid,
 235  233          action_list **alpp)
 236  234  {
 237  235          struct mapfs *mfs, *mp;
 238  236          int err = -1;
 239      -        int cached;
 240  237          action_list *alp;
 241  238          char *dir;
 242  239  
 243  240  
 244  241          alp = *alpp;
 245  242  
 246  243          read_default_nfs();
 247  244  
 248  245          mfs = enum_servers(me, prevhost);
 249  246          if (mfs == NULL)
↓ open down ↓ 21 lines elided ↑ open up ↑
 271  268                                          if (*alpp) {
 272  269                                                  free(*alpp);
 273  270                                                  *alpp = NULL;
 274  271                                          }
 275  272                                          break;
 276  273                                  }
 277  274                          }
 278  275                  }
 279  276          }
 280  277          if (err) {
 281      -                cached = strcmp(me->map_mounter, MNTTYPE_CACHEFS) == 0;
 282  278                  dir = strdup(mfs->mfs_dir);
 283  279                  err = nfsmount(mfs, mntpnt, me->map_mntopts,
 284      -                    cached, overlay, uid, alp);
      280 +                    overlay, uid, alp);
 285  281                  if (err && trace > 1) {
 286  282                          trace_prt(1, "  Couldn't mount %s:%s, err=%d\n",
 287  283                              mfs->mfs_host ? mfs->mfs_host : "",
 288  284                              mfs->mfs_dir ? mfs->mfs_dir : dir, err);
 289  285                  }
 290  286                  free(dir);
 291  287          }
 292  288          free_mfs(mfs);
 293  289          return (err);
 294  290  }
↓ open down ↓ 337 lines elided ↑ open up ↑
 632  628  
 633  629  done:
 634  630          dump_mfs(mfs_head, "  enum_servers: output: ", 1);
 635  631          return (mfs_head);
 636  632  }
 637  633  
 638  634  static enum nfsstat
 639  635  nfsmount(
 640  636          struct mapfs *mfs_in,
 641  637          char *mntpnt, char *opts,
 642      -        int cached, int overlay,
      638 +        int overlay,
 643  639          uid_t uid,
 644  640          action_list *alp)
 645  641  {
 646  642          CLIENT *cl;
 647  643          char remname[MAXPATHLEN], *mnttabtext = NULL;
 648  644          char mopts[MAX_MNTOPT_STR];
 649  645          char netname[MAXNETNAMELEN+1];
 650  646          char    *mntopts = NULL;
 651  647          int mnttabcnt = 0;
 652  648          int loglevel;
↓ open down ↓ 55 lines elided ↑ open up ↑
 708  704                      "mount on %s is soft and will not be replicated.", mntpnt);
 709  705                  replicated = 0;
 710  706          }
 711  707          if (replicated && !hasmntopt(&m, MNTOPT_RO)) {
 712  708                  if (verbose)
 713  709                          syslog(LOG_WARNING,
 714  710                      "mount on %s is not read-only and will not be replicated.",
 715  711                              mntpnt);
 716  712                  replicated = 0;
 717  713          }
 718      -        if (replicated && cached) {
 719      -                if (verbose)
 720      -                        syslog(LOG_WARNING,
 721      -                    "mount on %s is cached and will not be replicated.",
 722      -                            mntpnt);
 723      -                replicated = 0;
 724      -        }
 725  714          if (replicated)
 726  715                  loglevel = LOG_WARNING;
 727  716          else
 728  717                  loglevel = LOG_ERR;
 729  718  
 730  719          if (trace > 1) {
 731  720                  if (replicated)
 732  721                          trace_prt(1, "  nfsmount: replicated mount on %s %s:\n",
 733  722                              mntpnt, opts);
 734  723                  else
↓ open down ↓ 438 lines elided ↑ open up ↑
1173 1162                          syslog(LOG_ERR, "nfsmount: no memory");
1174 1163                          last_error = NFSERR_IO;
1175 1164                          goto out;
1176 1165                  }
1177 1166                  unbracket(&host);
1178 1167  
1179 1168                  (void) sprintf(remname, "%s:%s", rhost, dir);
1180 1169                  if (trace > 4 && replicated)
1181 1170                          trace_prt(1, "  nfsmount: examining %s\n", remname);
1182 1171  
1183      -                /*
1184      -                 * If it's cached we need to get cachefs to mount it.
1185      -                 */
1186      -                if (cached) {
1187      -                        char *copts = opts;
1188      -
1189      -                        /*
1190      -                         * If we started with a URL we need to turn on
1191      -                         * -o public if not on already
1192      -                         */
1193      -                        if (use_pubfh == FALSE &&
1194      -                            (mfs->mfs_flags & MFS_FH_VIA_WEBNFS)) {
1195      -
1196      -                                copts = malloc(strlen(opts) +
1197      -                                    strlen(",public")+1);
1198      -
1199      -                                if (copts == NULL) {
1200      -                                        syslog(LOG_ERR, "nfsmount: no memory");
1201      -                                        last_error = NFSERR_IO;
1202      -                                        goto out;
1203      -                                }
1204      -
1205      -                                strcpy(copts, opts);
1206      -
1207      -                                if (strlen(copts) != 0)
1208      -                                        strcat(copts, ",");
1209      -
1210      -                                strcat(copts, "public");
1211      -                        }
1212      -
1213      -                        last_error = mount_generic(remname, MNTTYPE_CACHEFS,
1214      -                            copts, mntpnt, overlay);
1215      -
1216      -                        if (copts != opts)
1217      -                                free(copts);
1218      -
1219      -                        if (last_error) {
1220      -                                skipentry = 1;
1221      -                                mfs->mfs_ignore = 1;
1222      -                                continue;
1223      -                        }
1224      -                        goto out;
1225      -                }
1226      -
1227 1172                  if (mfs->mfs_args == NULL) {
1228 1173  
1229 1174                          /*
1230 1175                           * Allocate nfs_args structure
1231 1176                           */
1232 1177                          argp = (struct nfs_args *)
1233 1178                              malloc(sizeof (struct nfs_args));
1234 1179  
1235 1180                          if (!argp) {
1236 1181                                  syslog(LOG_ERR, "nfsmount: no memory");
↓ open down ↓ 3207 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX