home *** CD-ROM | disk | FTP | other *** search
/ ftp.parl.clemson.edu / 2015-02-07.ftp.parl.clemson.edu.tar / ftp.parl.clemson.edu / pub / pvfs / old / pvfs-1.6.2-01292004.patch < prev    next >
Text File  |  2004-04-04  |  12KB  |  410 lines

  1. ---------------------
  2. PatchSet 654 
  3. Date: 2004/01/07 20:27:38
  4. Author: pcarns
  5. Branch: HEAD
  6. Tag: (none) 
  7. Log:
  8. fixed flaw in error reporting, spotted by Alexandr Konovalov
  9. <avkon@imm.uran.ru>
  10.  
  11. Members: 
  12.     iod/jobs.c:1.44->1.45 
  13.  
  14. Index: pvfs/iod/jobs.c
  15. diff -u pvfs/iod/jobs.c:1.44 pvfs/iod/jobs.c:1.45
  16. --- pvfs/iod/jobs.c:1.44    Wed Nov 12 11:11:57 2003
  17. +++ pvfs/iod/jobs.c    Wed Jan  7 15:27:38 2004
  18. @@ -383,7 +383,7 @@
  19.                      if (!j_p || alist_empty(j_p->al_p)) /* that's the end of this job */ {
  20.                          LOG("do_job: finished job - removing it\n");
  21.                          if (j_rem(jobs_p, sock) < 0) {
  22. -                            PERROR("do_job: j_rem");
  23. +                            ERR("do_job: j_rem failure");
  24.                          }    
  25.                          return(0);
  26.                      }
  27. ---------------------
  28. PatchSet 657 
  29. Date: 2004/01/15 13:00:06
  30. Author: rbross
  31. Branch: HEAD
  32. Tag: (none) 
  33. Log:
  34. fix bug in pvfs_open.c where pcount of less than zero would cause bad math.
  35.  
  36. Members: 
  37.     lib/pvfs_open.c:1.29->1.30 
  38.  
  39. Index: pvfs/lib/pvfs_open.c
  40. diff -u pvfs/lib/pvfs_open.c:1.29 pvfs/lib/pvfs_open.c:1.30
  41. --- pvfs/lib/pvfs_open.c:1.29    Thu Oct 23 14:06:43 2003
  42. +++ pvfs/lib/pvfs_open.c    Thu Jan 15 08:00:06 2004
  43. @@ -223,6 +223,7 @@
  44.      if (flag & O_META) {
  45.          req.req.open.meta.p_stat.base = meta_p->base;
  46.          niodservers = req.req.open.meta.p_stat.pcount = meta_p->pcount;
  47. +        if (niodservers < 0) niodservers = 0; /* pcount < 0 input is valid */
  48.          req.req.open.meta.p_stat.ssize = meta_p->ssize;
  49.      }
  50.      else {
  51. ---------------------
  52. PatchSet 658 
  53. Date: 2004/01/15 14:40:59
  54. Author: rbross
  55. Branch: HEAD
  56. Tag: (none) 
  57. Log:
  58. Added Don Porter's 12/24/2003 patch to reduce code in mgr.c by removing do_lstat().
  59.  
  60. Members: 
  61.     mgr/mgr.c:1.87->1.88 
  62.  
  63. Index: pvfs/mgr/mgr.c
  64. diff -u pvfs/mgr/mgr.c:1.87 pvfs/mgr/mgr.c:1.88
  65. --- pvfs/mgr/mgr.c:1.87    Mon Nov 24 20:51:43 2003
  66. +++ pvfs/mgr/mgr.c    Thu Jan 15 09:40:59 2004
  67. @@ -69,7 +69,7 @@
  68.      do_chmod,
  69.      do_chown,
  70.      do_close,
  71. -    do_lstat,
  72. +    do_stat, /*really this is do_lstat*/
  73.      do_noop,
  74.      do_open,
  75.      do_unlink,
  76. @@ -799,107 +799,9 @@
  77.      return(do_stat(sock, &fakereq, f_p->f_name, ack_p));
  78.  } /* end of do_fstat() */
  79.  
  80. -int do_lstat(int sock, mreq_p req_p, void *data_p, mack_p ack_p) {
  81. -    int ret, i;
  82. -    fsinfo_p fs_p;
  83. -    ireq iodreq;
  84. -
  85. -    /* variables used for calculating correct file size */
  86. -    uint64_t real_file_sz, tmp_file_sz, iod_file_sz;
  87. -    uint64_t strip_sz, stripe_sz, nr_strips, leftovers;
  88. -
  89. -    /* check for reserved name first */
  90. -    if (resv_name(data_p) != 0) {
  91. -        ack_p->status = -1;
  92. -        ack_p->eno = ENOENT;
  93. -        return(send_error(-1, errno, sock, ack_p));
  94. -    }
  95. -
  96. -    if ((fs_p = quick_mount(data_p, req_p->uid, req_p->gid, ack_p)) == NULL)
  97. -    {
  98. -        return(send_error(-1, errno, sock, ack_p));
  99. -    }    
  100. -
  101. -    /* We dont allow a lstat to follow a symbolic link */
  102. -    if ((ret = md_stat(data_p, req_p, &(ack_p->ack.stat.meta), NOFOLLOW_LINK)) != 0) {
  103. -        return(send_error(ret, errno, sock, ack_p));
  104. -    }
  105. -
  106. -    /* if regular file, get size from iods */
  107. -    if (S_ISREG(ack_p->ack.stat.meta.u_stat.st_mode)) {
  108. -        iodreq.majik_nr       = IOD_MAJIK_NR;
  109. -        iodreq.release_nr     = PVFS_RELEASE_NR;
  110. -        iodreq.type              = IOD_STAT;
  111. -        iodreq.dsize              = 0;
  112. -        iodreq.req.stat.f_ino = ack_p->ack.stat.meta.u_stat.st_ino;
  113. -        if ((ret = send_req(fs_p->iod, fs_p->nr_iods, 
  114. -            ack_p->ack.stat.meta.p_stat.base, ack_p->ack.stat.meta.p_stat.pcount, 
  115. -            &iodreq, data_p, NULL)) < 0)
  116. -        {
  117. -            return(send_error(ret, errno, sock, ack_p));
  118. -        }    
  119. -
  120. -        strip_sz = ack_p->ack.stat.meta.p_stat.ssize;
  121. -        stripe_sz = ack_p->ack.stat.meta.p_stat.ssize * 
  122. -                        ack_p->ack.stat.meta.p_stat.pcount;
  123. -        real_file_sz = 0;
  124. -
  125. -        for (i = 0; i < ack_p->ack.stat.meta.p_stat.pcount; i++) {
  126. -            /* i gives us the index into the iods, the ith iod in order */
  127. -            iod_file_sz = fs_p->iod[(i + ack_p->ack.stat.meta.p_stat.base) %
  128. -                          fs_p->nr_iods].ack.ack.stat.fsize;
  129. -            if (iod_file_sz == 0) continue;
  130. -
  131. -            /* the plan is to calculate the file size based on what
  132. -             * this particular iod has.  the largest of these sizes
  133. -             * is the actual file size, taking into account sparse
  134. -             * issues.
  135. -             *
  136. -             * there are four components to the calculation:
  137. -             *
  138. -             * soff = should be 0 since it isn't implemented :)
  139. -             *
  140. -             * nr_strips * stripe_sz = this is a calculation of how many
  141. -             *   complete stripes are present.  note that any partial strip
  142. -             *   or the last complete strip (if there are no partials)
  143. -             *   may not be part of a whole stripe (thus the if() below).
  144. -             *
  145. -             * i * strip_sz = this accounts for full strips that should be
  146. -             *   present on iods that come before us in the iod ordering
  147. -             *
  148. -             * leftovers = the last remaining bytes
  149. -             */
  150. -            nr_strips = iod_file_sz / strip_sz;
  151. -            leftovers = iod_file_sz % strip_sz;
  152. -            
  153. -            if (leftovers == 0) {
  154. -                nr_strips--;
  155. -                leftovers += strip_sz;
  156. -            }
  157. -            tmp_file_sz = nr_strips * stripe_sz + i * strip_sz +
  158. -                              leftovers;
  159. -            if (tmp_file_sz > real_file_sz) real_file_sz = tmp_file_sz;
  160. -        }
  161. -
  162. -        /* we're adding a 64-bit size field in addition to the st_size 
  163. -         * later i'll remove the addition into st_size probably
  164. -         * i'm leaving it for now
  165. -         */
  166. -        ack_p->ack.stat.meta.u_stat.st_size = real_file_sz;
  167. -        ack_p->ack.stat.meta.fsize = real_file_sz;
  168. -    }
  169. -    else if(S_ISLNK(ack_p->ack.stat.meta.u_stat.st_mode)) {
  170. -        /* fill up the size of the link file here */
  171. -        ack_p->ack.stat.meta.fsize = ack_p->ack.stat.meta.u_stat.st_size;
  172. -    }
  173. -
  174. -    if (!ack_p->status) return(bsend(sock, ack_p, sizeof(mack)));
  175. -    else send_error(-1, ack_p->eno, sock, ack_p);
  176. -
  177. -    if (!errno) errno = ack_p->eno; /* return the old error */
  178. -    return(-1);
  179. -} /* end of do_lstat() */
  180. -
  181. +/* do_stat() - also fills in for do_lstat.  this is done by checking
  182. + * the request type; see below.
  183. + */
  184.  int do_stat(int sock, mreq_p req_p, void *data_p, mack_p ack_p) {
  185.      int ret, i;
  186.      fsinfo_p fs_p;
  187. @@ -922,7 +824,7 @@
  188.      }    
  189.  
  190.      /* We allow a stat to follow a symbolic link */
  191. -    if ((ret = md_stat(data_p, req_p, &(ack_p->ack.stat.meta), FOLLOW_LINK)) != 0) {
  192. +    if ((ret = md_stat(data_p, req_p, &(ack_p->ack.stat.meta), req_p->type == MGR_LSTAT ? NOFOLLOW_LINK :FOLLOW_LINK)) != 0) {
  193.          return(send_error(ret, errno, sock, ack_p));
  194.      }
  195.  
  196. @@ -1020,6 +922,11 @@
  197.                      }
  198.                  }
  199.  #endif
  200. +            }
  201. +            else if(S_ISLNK(ack_p->ack.stat.meta.u_stat.st_mode) && req_p->type == MGR_LSTAT) {
  202. +                /* fill up the size of the link file here */
  203. +                /*is this even necessary??? */
  204. +                ack_p->ack.stat.meta.fsize = ack_p->ack.stat.meta.u_stat.st_size;
  205.              }
  206.  #ifdef MGR_USE_CACHED_FILE_SIZE
  207.          } /* if open or zero... */
  208. ---------------------
  209. PatchSet 659 
  210. Date: 2004/01/15 14:47:07
  211. Author: rbross
  212. Branch: HEAD
  213. Tag: (none) 
  214. Log:
  215. Applied Don Porter's eno patch.
  216.  
  217. Members: 
  218.     mgr/mgr.c:1.88->1.89 
  219.  
  220. Index: pvfs/mgr/mgr.c
  221. diff -u pvfs/mgr/mgr.c:1.88 pvfs/mgr/mgr.c:1.89
  222. --- pvfs/mgr/mgr.c:1.88    Thu Jan 15 09:40:59 2004
  223. +++ pvfs/mgr/mgr.c    Thu Jan 15 09:47:07 2004
  224. @@ -320,6 +320,7 @@
  225.              ack.type       = req.type; /* everything else is filled in in reqfn() */
  226.              ack.status     = 0;
  227.              ack.dsize      = 0;
  228. +            ack.eno        = 0;
  229.              LOG2("req: %s on %d\n", reqtext[req.type], sock);
  230.              ret = (reqfn[req.type])(sock, &req, buf_p, &ack); /* handle request */
  231.              continue;
  232. ---------------------
  233. PatchSet 660 
  234. Date: 2004/01/15 14:49:50
  235. Author: rbross
  236. Branch: HEAD
  237. Tag: (none) 
  238. Log:
  239. Applied Don Porter's correction to keep correct cached file size on truncate, plus permission check.
  240.  
  241. Members: 
  242.     mgr/mgr.c:1.89->1.90 
  243.  
  244. Index: pvfs/mgr/mgr.c
  245. diff -u pvfs/mgr/mgr.c:1.89 pvfs/mgr/mgr.c:1.90
  246. --- pvfs/mgr/mgr.c:1.89    Thu Jan 15 09:47:07 2004
  247. +++ pvfs/mgr/mgr.c    Thu Jan 15 09:49:50 2004
  248. @@ -539,13 +539,12 @@
  249.      /* get metadata, check permission to write to file */
  250.      if ((fd = meta_open(data_p, O_RDONLY)) < 0
  251.      || (meta_read(fd, &meta) < 0)
  252. +   || ((meta_access(fd, data_p, req_p->uid, req_p->gid, W_OK)) < 0)
  253.      || (meta_close(fd) < 0))
  254.      {
  255.          return(send_error(-1, errno, sock, ack_p));
  256.      }
  257.  
  258. -    /* for the moment permissions aren't checked... */
  259. -
  260.      /* build request for iods, send it */
  261.      memset(&iodreq, 0, sizeof(iodreq));
  262.      iodreq.majik_nr = IOD_MAJIK_NR;
  263. @@ -562,6 +561,21 @@
  264.      {
  265.          return(send_error(ret, errno, sock, ack_p));
  266.      }    
  267. +
  268. +#ifdef FAST_STATS
  269. +    meta.u_stat.st_size = req_p->req.truncate.length;
  270. +    meta.fsize = req_p->req.truncate.length;
  271. +
  272. +    /* write metadata*/
  273. +    if ((fd = meta_open(data_p, O_RDONLY)) < 0
  274. +    || (meta_write(fd, &meta) < 0)
  275. +    || (meta_close(fd) < 0))
  276. +    {
  277. +        return(send_error(-1, errno, sock, ack_p));
  278. +    }
  279. +    
  280. +#endif
  281. +
  282.      if (sock >= 0) /* real socket number, send the ack */ {
  283.          ret = bsend(sock, ack_p, sizeof(mack));
  284.          if (ret < 0) return(-1);
  285. ---------------------
  286. PatchSet 661 
  287. Date: 2004/01/15 14:58:21
  288. Author: pcarns
  289. Branch: HEAD
  290. Tag: (none) 
  291. Log:
  292. removed the use of bvrecv() to pull in both the ack and trailing data from
  293. the mgr at the same time, and broke into two seperate brecv() calls.  This
  294. gives us the chance to check the ack status before commiting to trying
  295. to grab more data out of the socket
  296.  
  297. Members: 
  298.     lib/mgrcomm.c:1.23->1.24 
  299.  
  300. Index: pvfs/lib/mgrcomm.c
  301. diff -u pvfs/lib/mgrcomm.c:1.23 pvfs/lib/mgrcomm.c:1.24
  302. --- pvfs/lib/mgrcomm.c:1.23    Wed Oct 22 07:17:46 2003
  303. +++ pvfs/lib/mgrcomm.c    Thu Jan 15 09:58:21 2004
  304. @@ -175,55 +175,22 @@
  305.              return(-1);
  306.          }
  307.      }
  308. -    /* Do things differently if it is a open request with ackdsize != 0 */
  309. -    if(req_p->type == MGR_OPEN
  310. -            && (ackdsize = req_p->req.open.ackdsize) != 0) {
  311. -        int bvrecvret = 0;
  312. -        if(recv_p == NULL) {
  313. -            close(fd);
  314. -            if (!newconn) {
  315. -                badmgrfd(fd);
  316. -                goto make_new_conn; /* try to reopen connection */
  317. -            }
  318. -            errno = EFAULT;
  319. -            PERROR("send_mreq_saddr (receiving ack with bvrecv)");
  320. -            return -1;
  321. -        }
  322. -        /* recv ack and trailing data with a single call */
  323. -        vec[0].iov_base = ack_p;
  324. -        vec[0].iov_len = sizeof(mack);
  325. -        vec[1].iov_base = recv_p;
  326. -        vec[1].iov_len = ackdsize;
  327. -        bvrecvret = bvrecv(fd, vec, 2);
  328. -        if(bvrecvret < (sizeof(mack) + ackdsize)) {
  329. -            err = errno;
  330. -            PERROR("send_mreq_saddr (receiving ack with bvrecv)");
  331. -            close(fd);
  332. -            if (!newconn) {
  333. -                badmgrfd(fd);
  334. -                goto make_new_conn; /* try to reopen connection */
  335. -            }
  336. -            errno = err;
  337. -            return(-1);
  338. -        }
  339. -    }
  340. -    else {
  341. -        /* receive ack.  Give up if it does not happen in reasonable amount
  342. -         * of time.
  343. -         */
  344. -        if(brecv_timeout(fd, ack_p, sizeof(mack), MGRCOMM_BRECV_TIMEOUT_SECS) 
  345. -            < (int)sizeof(mack)){
  346. -            err = errno;
  347. -            PERROR("send_mreq_saddr (receiving ack)");
  348. -            close(fd);
  349. -            if(!newconn){
  350. -                badmgrfd(fd);
  351. -                goto make_new_conn; /* try to reopen connection */
  352. -            }
  353. -            errno = err;
  354. -            return(-1);
  355. +    /* receive ack.  Give up if it does not happen in reasonable amount
  356. +     * of time.
  357. +     */
  358. +    if(brecv_timeout(fd, ack_p, sizeof(mack), MGRCOMM_BRECV_TIMEOUT_SECS) 
  359. +        < (int)sizeof(mack)){
  360. +        err = errno;
  361. +        PERROR("send_mreq_saddr (receiving ack)");
  362. +        close(fd);
  363. +        if(!newconn){
  364. +            badmgrfd(fd);
  365. +            goto make_new_conn; /* try to reopen connection */
  366.          }
  367. +        errno = err;
  368. +        return(-1);
  369.      }
  370. +
  371.      if (ack_p->majik_nr != MGR_MAJIK_NR) /* serious error -- nonsense ack */ {
  372.          close(fd);
  373.          if (!newconn) badmgrfd(fd);
  374. @@ -250,6 +217,35 @@
  375.          errno = ack_p->eno;
  376.          return(-1);
  377.      }
  378. +    
  379. +    /* if ackdsize != 0 on a MGR_OPEN request, then it indicates that we
  380. +     * need to pull in some trailing data as well
  381. +     */
  382. +    if(req_p->type == MGR_OPEN
  383. +            && (ackdsize = req_p->req.open.ackdsize) != 0) {
  384. +        /* make sure that we were given a buffer for trailing data */
  385. +        if(recv_p == NULL) {
  386. +            close(fd);
  387. +            errno = EFAULT;
  388. +            PERROR("send_mreq_saddr (receiving ack with bvrecv)");
  389. +            return -1;
  390. +        }
  391. +        /* recv trailing data, timeout if we don't get it in time */
  392. +        if(brecv_timeout(fd, recv_p, ackdsize, MGRCOMM_BRECV_TIMEOUT_SECS)
  393. +            < ackdsize)
  394. +        {
  395. +            err = errno;
  396. +            PERROR("send_mreq_saddr (receiving trailing data with brecv)");
  397. +            close(fd);
  398. +            if (!newconn) {
  399. +                badmgrfd(fd);
  400. +                goto make_new_conn; /* try to reopen connection */
  401. +            }
  402. +            errno = err;
  403. +            return(-1);
  404. +        }
  405. +    }
  406. +
  407.      return(fd);
  408.  } /* end of send_mreq_saddr() */
  409.  
  410.