glusterfs  8.2
About: GlusterFS is a network/cluster filesystem. The storage server (or each in a cluster) runs glusterfsd and the clients use mount command or glusterfs client to mount the exported filesystem. Release series 8.x (latest version).
  Fossies Dox: glusterfs-8.2.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

nfs3-helpers.c
Go to the documentation of this file.
1 /*
2  Copyright (c) 2010-2011 Gluster, Inc. <http://www.gluster.com>
3  This file is part of GlusterFS.
4 
5  This file is licensed to you under your choice of the GNU Lesser
6  General Public License, version 3 or any later version (LGPLv3 or
7  later), or the GNU General Public License, version 2 (GPLv2), in all
8  cases as published by the Free Software Foundation.
9 */
10 
11 #include <inttypes.h>
12 
13 #include <glusterfs/xlator.h>
14 #include "nfs3.h"
15 #include "nfs3-fh.h"
16 #include "msg-nfs3.h"
17 #include <glusterfs/rbthash.h>
18 #include "nfs-fops.h"
19 #include "nfs-inodes.h"
20 #include "nfs-generics.h"
21 #include "nfs3-helpers.h"
22 #include "nfs-mem-types.h"
23 #include <glusterfs/iatt.h>
24 #include <glusterfs/common-utils.h>
25 #include "nfs-messages.h"
26 #include "mount3.h"
27 #include <string.h>
28 
29 extern int
30 nfs3_set_root_looked_up(struct nfs3_state *nfs3, struct nfs3_fh *rootfh);
31 
32 extern int
33 nfs3_is_root_looked_up(struct nfs3_state *nfs3, struct nfs3_fh *rootfh);
34 
35 #define nfs3_call_resume(cst) \
36  do { \
37  if (((cst)) && (cst)->resume_fn) \
38  (cst)->resume_fn(cst); \
39  } while (0)
40 
41 #define nfs3_call_resume_estale(csta) \
42  do { \
43  (csta)->resolve_ret = -1; \
44  (csta)->resolve_errno = ESTALE; \
45  nfs3_call_resume(csta); \
46  } while (0)
47 
50  char strerror[100];
51 };
52 
54  {NFS3_OK, "Call completed successfully."},
55  {NFS3ERR_PERM, "Not owner"},
56  {NFS3ERR_NOENT, "No such file or directory"},
57  {NFS3ERR_IO, "I/O error"},
58  {NFS3ERR_NXIO, "I/O error"},
59  {NFS3ERR_ACCES, "Permission denied"},
60  {NFS3ERR_EXIST, "File exists"},
61  {NFS3ERR_XDEV, "Attempt to do a cross-device hard link"},
62  {NFS3ERR_NODEV, "No such device"},
63  {NFS3ERR_NOTDIR, "Not a directory"},
64  {NFS3ERR_ISDIR, "Is a directory"},
65  {NFS3ERR_INVAL, "Invalid argument for operation"},
66  {NFS3ERR_FBIG, "File too large"},
67  {NFS3ERR_NOSPC, "No space left on device"},
68  {NFS3ERR_ROFS, "Read-only file system"},
69  {NFS3ERR_MLINK, "Too many hard links"},
70  {NFS3ERR_NAMETOOLONG, "Filename in operation was too long"},
71  {NFS3ERR_NOTEMPTY, "Directory not empty"},
72  {NFS3ERR_DQUOT, "Resource (quota) hard limit exceeded"},
73  {NFS3ERR_STALE, "Invalid file handle"},
74  {NFS3ERR_REMOTE, "Too many levels of remote in path"},
75  {NFS3ERR_BADHANDLE, "Illegal NFS file handle"},
76  {NFS3ERR_NOT_SYNC, "Update synchronization mismatch detected"},
77  {NFS3ERR_BAD_COOKIE, "READDIR or READDIRPLUS cookie is stale"},
78  {NFS3ERR_NOTSUPP, "Operation is not supported"},
79  {NFS3ERR_TOOSMALL, "Buffer or request is too small"},
80  {NFS3ERR_SERVERFAULT, "Error occurred on the server or IO Error"},
81  {NFS3ERR_BADTYPE, "Type not supported by the server"},
82  {NFS3ERR_JUKEBOX, "Cannot complete server initiated request"},
83  {NFS3ERR_END_OF_LIST, "IO Error"},
84 
85 };
86 
87 uint64_t
89 {
90  uint64_t ino = 0;
91 
92  if (!buf)
93  return 0;
94 
95  if (gf_nfs_enable_ino32()) {
96  ino = (uint32_t)nfs_hash_gfid(buf->ia_gfid);
97  goto hashout;
98  }
99 
100  /* from posix its guaranteed to send unique ino */
101  ino = buf->ia_ino;
102 
103 hashout:
104  return ino;
105 }
106 
107 void
108 nfs3_map_deviceid_to_statdev(struct iatt *ia, uint64_t deviceid)
109 {
110  if (!ia)
111  return;
112 
113  ia->ia_dev = deviceid;
114 }
115 
116 struct nfs3_fh
118 {
119  struct nfs3_fh gfh;
120 
121  memcpy(&gfh, fh.data.data_val, fh.data.data_len);
122  return gfh;
123 }
124 
125 struct nfs3_fh
127 {
128  return nfs3_extract_nfs3_fh(args->what.dir);
129 }
130 
131 char *
133 {
134  return args->what.name;
135 }
136 
137 nfsstat3
139 {
140  nfsstat3 stat = NFS3_OK;
141 
142  switch (errnum) {
143  case 0:
144  stat = NFS3_OK;
145  break;
146 
147  case EPERM:
148  stat = NFS3ERR_PERM;
149  break;
150 
151  case ENOENT:
152  stat = NFS3ERR_NOENT;
153  break;
154 
155  case EACCES:
156  stat = NFS3ERR_ACCES;
157  break;
158 
159  case EEXIST:
160  stat = NFS3ERR_EXIST;
161  break;
162 
163  case EXDEV:
164  stat = NFS3ERR_XDEV;
165  break;
166 
167  case ENODEV:
168  stat = NFS3ERR_NODEV;
169  break;
170 
171  case EIO:
172  stat = NFS3ERR_IO;
173  break;
174 
175  case ENXIO:
176  stat = NFS3ERR_NXIO;
177  break;
178 
179  case ENOTDIR:
180  stat = NFS3ERR_NOTDIR;
181  break;
182 
183  case EISDIR:
184  stat = NFS3ERR_ISDIR;
185  break;
186 
187  case EINVAL:
188  stat = NFS3ERR_INVAL;
189  break;
190 
191  case ENOSPC:
192  stat = NFS3ERR_NOSPC;
193  break;
194 
195  case EROFS:
196  stat = NFS3ERR_ROFS;
197  break;
198 
199  case EFBIG:
200  stat = NFS3ERR_FBIG;
201  break;
202 
203  case EMLINK:
204  stat = NFS3ERR_MLINK;
205  break;
206 
207  case ENAMETOOLONG:
208  stat = NFS3ERR_NAMETOOLONG;
209  break;
210 
211  case ENOTEMPTY:
212  stat = NFS3ERR_NOTEMPTY;
213  break;
214 
215  case EFAULT:
216  stat = NFS3ERR_SERVERFAULT;
217  break;
218 
219  case ENOTSUP:
220  case ENOSYS:
221  stat = NFS3ERR_NOTSUPP;
222  break;
223 
224  case EBADF:
225  stat = NFS3ERR_BADTYPE;
226  break;
227 
228  case ESTALE:
229  stat = NFS3ERR_STALE;
230  break;
231 
232  case ENOTCONN:
233  stat = NFS3ERR_IO;
234  break;
235 
236  case EDQUOT:
237  stat = NFS3ERR_DQUOT;
238  break;
239 
240  default:
241  stat = NFS3ERR_SERVERFAULT;
242  break;
243  }
244 
245  return stat;
246 }
247 
248 /*
249  * Special case: If op_ret is -1, it's very unusual op_errno being
250  * 0 which means something came wrong from upper layer(s). If it
251  * happens by any means, then set NFS3 status to NFS3ERR_SERVERFAULT.
252  */
253 nfsstat3
254 nfs3_cbk_errno_status(int32_t op_ret, int32_t op_errno)
255 {
256  if ((op_ret == -1) && (op_errno == 0)) {
257  return NFS3ERR_SERVERFAULT;
258  }
259 
260  return nfs3_errno_to_nfsstat3(op_errno);
261 }
262 
263 void
265 {
266  memset(res, 0, sizeof(*res));
267  res->status = stat;
268  if (!dirstat) {
270  }
271 }
272 
273 void
274 nfs3_stat_to_fattr3(struct iatt *buf, fattr3 *fa)
275 {
276  if (buf == NULL || fa == NULL) {
277  errno = EINVAL;
278  return;
279  }
280 
281  if (IA_ISDIR(buf->ia_type))
282  fa->type = NF3DIR;
283  else if (IA_ISREG(buf->ia_type))
284  fa->type = NF3REG;
285  else if (IA_ISCHR(buf->ia_type))
286  fa->type = NF3CHR;
287  else if (IA_ISBLK(buf->ia_type))
288  fa->type = NF3BLK;
289  else if (IA_ISFIFO(buf->ia_type))
290  fa->type = NF3FIFO;
291  else if (IA_ISLNK(buf->ia_type))
292  fa->type = NF3LNK;
293  else if (IA_ISSOCK(buf->ia_type))
294  fa->type = NF3SOCK;
295 
296  if (IA_PROT_RUSR(buf->ia_prot))
297  fa->mode |= NFS3MODE_ROWNER;
298  if (IA_PROT_WUSR(buf->ia_prot))
299  fa->mode |= NFS3MODE_WOWNER;
300  if (IA_PROT_XUSR(buf->ia_prot))
301  fa->mode |= NFS3MODE_XOWNER;
302 
303  if (IA_PROT_RGRP(buf->ia_prot))
304  fa->mode |= NFS3MODE_RGROUP;
305  if (IA_PROT_WGRP(buf->ia_prot))
306  fa->mode |= NFS3MODE_WGROUP;
307  if (IA_PROT_XGRP(buf->ia_prot))
308  fa->mode |= NFS3MODE_XGROUP;
309 
310  if (IA_PROT_ROTH(buf->ia_prot))
311  fa->mode |= NFS3MODE_ROTHER;
312  if (IA_PROT_WOTH(buf->ia_prot))
313  fa->mode |= NFS3MODE_WOTHER;
314  if (IA_PROT_XOTH(buf->ia_prot))
315  fa->mode |= NFS3MODE_XOTHER;
316 
317  if (IA_PROT_SUID(buf->ia_prot))
318  fa->mode |= NFS3MODE_SETXUID;
319  if (IA_PROT_SGID(buf->ia_prot))
320  fa->mode |= NFS3MODE_SETXGID;
321  if (IA_PROT_STCKY(buf->ia_prot))
322  fa->mode |= NFS3MODE_SAVESWAPTXT;
323 
324  fa->nlink = buf->ia_nlink;
325  fa->uid = buf->ia_uid;
326  fa->gid = buf->ia_gid;
327  fa->size = buf->ia_size;
328  fa->used = (buf->ia_blocks * 512);
329 
330  if ((IA_ISCHR(buf->ia_type) || IA_ISBLK(buf->ia_type))) {
331  fa->rdev.specdata1 = ia_major(buf->ia_rdev);
332  fa->rdev.specdata2 = ia_minor(buf->ia_rdev);
333  } else {
334  fa->rdev.specdata1 = 0;
335  fa->rdev.specdata2 = 0;
336  }
337 
338  fa->fsid = buf->ia_dev;
339  fa->fileid = nfs3_iatt_gfid_to_ino(buf);
340 
341  fa->atime.seconds = buf->ia_atime;
342  fa->atime.nseconds = buf->ia_atime_nsec;
343 
344  fa->ctime.seconds = buf->ia_ctime;
345  fa->ctime.nseconds = buf->ia_ctime_nsec;
346 
347  fa->mtime.seconds = buf->ia_mtime;
348  fa->mtime.nseconds = buf->ia_mtime_nsec;
349 }
350 
353 {
354  post_op_attr attr = {
355  0,
356  };
357  if (!buf)
358  return attr;
359 
360  /* Some performance translators return zero-filled stats when they
361  * do not have up-to-date attributes. Need to handle this by not
362  * returning these zeroed out attrs.
363  */
364  attr.attributes_follow = FALSE;
365  if (gf_is_zero_filled_stat(buf))
366  goto out;
367 
369  attr.attributes_follow = TRUE;
370 
371 out:
372  return attr;
373 }
374 
377 {
378  pre_op_attr poa = {
379  0,
380  };
381 
382  /* Some performance translators return zero-filled stats when they
383  * do not have up-to-date attributes. Need to handle this by not
384  * returning these zeroed out attrs.
385  */
386  poa.attributes_follow = FALSE;
387  if (gf_is_zero_filled_stat(pre))
388  goto out;
389 
390  poa.attributes_follow = TRUE;
396 
397 out:
398  return poa;
399 }
400 
401 void
403  struct iatt *buf, struct iatt *postparent)
404 {
405  post_op_attr obj, dir;
406  uint32_t fhlen = 0;
407 
408  res->status = stat;
409  if (fh) {
410  res->lookup3res_u.resok.object.data.data_val = (void *)fh;
411  fhlen = nfs3_fh_compute_size();
412  res->lookup3res_u.resok.object.data.data_len = fhlen;
413  }
414 
415  obj.attributes_follow = FALSE;
416  dir.attributes_follow = FALSE;
417  obj = nfs3_stat_to_post_op_attr(buf);
418  dir = nfs3_stat_to_post_op_attr(postparent);
419 
420  res->lookup3res_u.resok.obj_attributes = obj;
421  res->lookup3res_u.resok.dir_attributes = dir;
422 }
423 
424 void
426  struct iatt *buf, struct iatt *postparent,
427  uint64_t deviceid)
428 {
429  memset(res, 0, sizeof(*res));
430  nfs3_map_deviceid_to_statdev(buf, deviceid);
431  nfs3_map_deviceid_to_statdev(postparent, deviceid);
432  if (stat != NFS3_OK)
433  nfs3_fill_lookup3res_error(res, stat, postparent);
434  else
435  nfs3_fill_lookup3res_success(res, stat, newfh, buf, postparent);
436 }
437 
438 struct nfs3_fh
440 {
441  return nfs3_extract_nfs3_fh(args->object);
442 }
443 
444 void
446  uint64_t deviceid)
447 {
448  memset(res, 0, sizeof(*res));
449  res->status = stat;
450  if (stat != NFS3_OK)
451  return;
452 
453  nfs3_map_deviceid_to_statdev(buf, deviceid);
455 }
456 
457 struct nfs3_fh
459 {
460  return nfs3_extract_nfs3_fh(args->fsroot);
461 }
462 
463 void
465  struct iatt *fsroot, uint64_t deviceid)
466 {
467  fsinfo3resok resok = {
468  {0},
469  };
471 
472  memset(res, 0, sizeof(*res));
473  res->status = status;
474  if (status != NFS3_OK)
475  return;
476 
477  nfs3_map_deviceid_to_statdev(fsroot, deviceid);
479  resok.rtmax = nfs3->readsize;
480  resok.rtpref = nfs3->readsize;
481  resok.rtmult = GF_NFS3_RTMULT;
482  resok.wtmax = nfs3->writesize;
483  resok.wtpref = nfs3->writesize;
484  resok.wtmult = GF_NFS3_WTMULT;
485  resok.dtpref = nfs3->readdirsize;
487  resok.time_delta = tdelta;
488  resok.properties = GF_NFS3_FS_PROP;
489 
490  res->fsinfo3res_u.resok = resok;
491 }
492 
493 void
495 {
496  memset(args, 0, sizeof(*args));
497  args->what.dir.data.data_val = (void *)fh;
498  args->what.name = name;
499 }
500 
501 void
503 {
504  memset(args, 0, sizeof(*args));
505  args->object.data.data_val = (void *)fh;
506 }
507 
508 void
510 {
511  memset(args, 0, sizeof(*args));
512  args->fsroot.data.data_val = (void *)root;
513 }
514 
515 char *
517 {
518  int i;
519  for (i = 0; nfs3stat_strerror_table[i].stat != NFS3ERR_END_OF_LIST; i++) {
520  if (nfs3stat_strerror_table[i].stat == stat)
522  }
523 
525 }
526 
527 void
529 {
530  memset(args, 0, sizeof(*args));
531  args->object.data.data_val = (void *)fh;
532 }
533 
534 #define POSIX_READ 4
535 #define POSIX_WRITE 2
536 #define POSIX_EXEC 1
537 
538 uint32_t
539 nfs3_accessbits(int32_t accbits)
540 {
541  uint32_t accresult = 0;
542 
543  if (accbits & POSIX_READ)
544  accresult |= ACCESS3_READ;
545 
546  if (accbits & POSIX_WRITE)
547  accresult |= (ACCESS3_MODIFY | ACCESS3_EXTEND | ACCESS3_DELETE);
548 
549  /* lookup on directory allowed only in case of execute permission */
550  if (accbits & POSIX_EXEC)
551  accresult |= (ACCESS3_EXECUTE | ACCESS3_LOOKUP);
552 
553  return accresult;
554 }
555 
556 uint32_t
558 {
559  uint32_t acc_request = 0;
560 
561  if (accbits & ACCESS3_READ)
562  acc_request |= POSIX_READ;
563 
564  if (accbits & (ACCESS3_MODIFY | ACCESS3_EXTEND | ACCESS3_DELETE))
565  acc_request |= POSIX_WRITE;
566 
567  /* For lookup on directory check for execute permission */
568  if (accbits & (ACCESS3_EXECUTE | ACCESS3_LOOKUP))
569  acc_request |= POSIX_EXEC;
570 
571  return acc_request;
572 }
573 void
574 nfs3_fill_access3res(access3res *res, nfsstat3 status, int32_t accbits,
575  int32_t reqaccbits)
576 {
577  uint32_t accres = 0;
578 
579  memset(res, 0, sizeof(*res));
580  res->status = status;
581  if (status != NFS3_OK)
582  return;
583 
584  accres = nfs3_accessbits(accbits);
585 
586  /* do not answer what was not asked */
587  res->access3res_u.resok.access = accres & reqaccbits;
588 }
589 
590 void
592 {
593  memset(ra, 0, sizeof(*ra));
594  ra->dir.data.data_val = (void *)fh;
595 }
596 
597 int
598 nfs3_is_dot_entry(char *entry)
599 {
600  int ret = 0;
601 
602  if (!entry)
603  return 0;
604 
605  if (strcmp(entry, ".") == 0)
606  ret = 1;
607 
608  return ret;
609 }
610 
611 int
613 {
614  int ret = 0;
615 
616  if (!entry)
617  return 0;
618 
619  if (strcmp(entry, "..") == 0)
620  ret = 1;
621 
622  return ret;
623 }
624 
625 void
627 {
628  if ((!ent) || (!dfh))
629  return;
630 
632  ent->d_ino = 1;
633  ent->d_stat.ia_ino = 1;
634  }
635 
636  if (nfs3_fh_is_root_fh(dfh) && nfs3_is_dot_entry(ent->d_name)) {
637  ent->d_ino = 1;
638  ent->d_stat.ia_ino = 1;
639  }
640 }
641 
642 entry3 *
644 {
645  entry3 *ent = NULL;
646  int name_len = 0;
647  if ((!entry) || (!dfh))
648  return NULL;
649 
650  ent = GF_CALLOC(1, sizeof(*ent), gf_nfs_mt_entry3);
651  if (!ent)
652  return NULL;
653 
654  gf_msg_trace(GF_NFS3, 0, "Entry: %s", entry->d_name);
655 
656  /* If the entry is . or .., we need to replace the physical ino and gen
657  * with 1 and 0 respectively if the directory is root. This funging is
658  * needed because there is no parent directory of the root. In that
659  * sense the behavior we provide is similar to the output of the
660  * command: "stat /.."
661  */
662  entry->d_ino = nfs3_iatt_gfid_to_ino(&entry->d_stat);
663  nfs3_funge_root_dotdot_dirent(entry, dfh);
664  ent->fileid = entry->d_ino;
665  ent->cookie = entry->d_off;
666  name_len = strlen(entry->d_name);
667  ent->name = GF_MALLOC(name_len + 1, gf_nfs_mt_char);
668  if (!ent->name) {
669  GF_FREE(ent);
670  ent = NULL;
671  goto err;
672  }
673  strcpy(ent->name, entry->d_name);
674  ent->name[name_len] = '\0';
675 
676 err:
677  return ent;
678 }
679 
680 void
682 {
683  uint32_t fhlen = 0;
684 
685  if ((!fh) || (!pfh))
686  return;
687 
688  pfh->handle_follows = 1;
689  fhlen = nfs3_fh_compute_size();
690  pfh->post_op_fh3_u.handle.data.data_val = (void *)fh;
691  pfh->post_op_fh3_u.handle.data.data_len = fhlen;
692 }
693 
696 {
697  post_op_fh3 pfh = {
698  0,
699  };
700  char *fhp = NULL;
701 
702  if (!fh)
703  return pfh;
704 
705  pfh.handle_follows = 1;
706 
707  fhp = GF_MALLOC(sizeof(*fh), gf_nfs_mt_char);
708  if (!fhp)
709  return pfh;
710 
711  memcpy(fhp, fh, sizeof(*fh));
712  nfs3_fill_post_op_fh3((struct nfs3_fh *)fhp, &pfh);
713  return pfh;
714 }
715 
716 entryp3 *
717 nfs3_fill_entryp3(gf_dirent_t *entry, struct nfs3_fh *dirfh, uint64_t devid)
718 {
719  entryp3 *ent = NULL;
720  struct nfs3_fh newfh = {
721  {0},
722  };
723  int name_len = 0;
724 
725  if ((!entry) || (!dirfh))
726  return NULL;
727 
728  /* If the entry is . or .., we need to replace the physical ino and gen
729  * with 1 and 0 respectively if the directory is root. This funging is
730  * needed because there is no parent directory of the root. In that
731  * sense the behavior we provide is similar to the output of the
732  * command: "stat /.."
733  */
734  entry->d_ino = nfs3_iatt_gfid_to_ino(&entry->d_stat);
735  nfs3_funge_root_dotdot_dirent(entry, dirfh);
736  gf_msg_trace(GF_NFS3, 0, "Entry: %s, ino: %" PRIu64, entry->d_name,
737  entry->d_ino);
738  ent = GF_CALLOC(1, sizeof(*ent), gf_nfs_mt_entryp3);
739  if (!ent)
740  return NULL;
741 
742  ent->fileid = entry->d_ino;
743  ent->cookie = entry->d_off;
744  name_len = strlen(entry->d_name);
745  ent->name = GF_MALLOC(name_len + 1, gf_nfs_mt_char);
746  if (!ent->name) {
747  GF_FREE(ent);
748  ent = NULL;
749  goto err;
750  }
751  strcpy(ent->name, entry->d_name);
752  ent->name[name_len] = '\0';
753 
754  nfs3_fh_build_child_fh(dirfh, &entry->d_stat, &newfh);
755  nfs3_map_deviceid_to_statdev(&entry->d_stat, devid);
756  /* *
757  * In tier volume, the readdirp send only to cold subvol
758  * which will populate in the 'T' file entries in the result.
759  * For such files an explicit stat call is required, by setting
760  * following argument client will perform the same.
761  *
762  * The inode value for 'T' files and directory is NULL, so just
763  * skip the check if it is directory.
764  */
765  if (!(IA_ISDIR(entry->d_stat.ia_type)) && (entry->inode == NULL))
766  ent->name_attributes.attributes_follow = FALSE;
767  else
769 
770  ent->name_handle = nfs3_fh_to_post_op_fh3(&newfh);
771 err:
772  return ent;
773 }
774 
775 void
777  uint64_t cverf, struct iatt *dirstat,
778  gf_dirent_t *entries, count3 count, int is_eof,
779  uint64_t deviceid)
780 {
781  post_op_attr dirattr;
782  entry3 *ent = NULL;
783  entry3 *headentry = NULL;
784  entry3 *preventry = NULL;
785  count3 filled = 0;
786  gf_dirent_t *listhead = NULL;
787 
788  memset(res, 0, sizeof(*res));
789  res->status = stat;
790  if (stat != NFS3_OK)
791  return;
792 
793  nfs3_map_deviceid_to_statdev(dirstat, deviceid);
794  dirattr = nfs3_stat_to_post_op_attr(dirstat);
795  res->readdir3res_u.resok.dir_attributes = dirattr;
796  res->readdir3res_u.resok.reply.eof = (bool_t)is_eof;
797  memcpy(res->readdir3res_u.resok.cookieverf, &cverf, sizeof(cverf));
798 
799  filled = NFS3_READDIR_RESOK_SIZE;
800  /* First entry is just the list head */
801  listhead = entries;
802  entries = entries->next;
803  while (((entries) && (entries != listhead)) && (filled < count)) {
804  /*
805  if ((strcmp (entries->d_name, ".") == 0) ||
806  (strcmp (entries->d_name, "..") == 0))
807  goto nextentry;
808  */
809  ent = nfs3_fill_entry3(entries, dirfh);
810  if (!ent)
811  break;
812 
813  if (!headentry)
814  headentry = ent;
815 
816  if (preventry) {
817  preventry->nextentry = ent;
818  preventry = ent;
819  } else
820  preventry = ent;
821 
822  filled += NFS3_ENTRY3_FIXED_SIZE + strlen(ent->name);
823  // nextentry:
824  entries = entries->next;
825  }
826 
827  res->readdir3res_u.resok.reply.entries = headentry;
828 
829  return;
830 }
831 
832 void
834  uint64_t cverf, struct iatt *dirstat,
835  gf_dirent_t *entries, count3 dircount, count3 maxcount,
836  int is_eof, uint64_t deviceid)
837 {
838  post_op_attr dirattr;
839  entryp3 *ent = NULL;
840  entryp3 *headentry = NULL;
841  entryp3 *preventry = NULL;
842  count3 filled = 0;
843  gf_dirent_t *listhead = NULL;
844  int fhlen = 0;
845 
846  memset(res, 0, sizeof(*res));
847  res->status = stat;
848  if (stat != NFS3_OK)
849  return;
850 
851  nfs3_map_deviceid_to_statdev(dirstat, deviceid);
852  dirattr = nfs3_stat_to_post_op_attr(dirstat);
853  res->readdirp3res_u.resok.dir_attributes = dirattr;
854  res->readdirp3res_u.resok.reply.eof = (bool_t)is_eof;
855  memcpy(res->readdirp3res_u.resok.cookieverf, &cverf, sizeof(cverf));
856 
857  filled = NFS3_READDIR_RESOK_SIZE;
858  /* First entry is just the list head */
859  listhead = entries;
860  entries = entries->next;
861  while (((entries) && (entries != listhead)) && (filled < maxcount)) {
862  /* Linux does not display . and .. entries unless we provide
863  * these entries here.
864  */
865  /* if ((strcmp (entries->d_name, ".") == 0) ||
866  (strcmp (entries->d_name, "..") == 0))
867  goto nextentry;
868  */
869  ent = nfs3_fill_entryp3(entries, dirfh, deviceid);
870  if (!ent)
871  break;
872 
873  if (!headentry)
874  headentry = ent;
875 
876  if (preventry) {
877  preventry->nextentry = ent;
878  preventry = ent;
879  } else
880  preventry = ent;
881 
883  filled += NFS3_ENTRYP3_FIXED_SIZE + fhlen + strlen(ent->name);
884  // nextentry:
885  entries = entries->next;
886  }
887 
888  res->readdirp3res_u.resok.reply.entries = headentry;
889 
890  return;
891 }
892 
893 void
895 {
896  memset(ra, 0, sizeof(*ra));
897  ra->dir.data.data_val = (void *)fh;
898 }
899 
900 void
902 {
903  entryp3 *ent = NULL;
904  entryp3 *next = NULL;
905 
906  if (!res)
907  return;
908 
909  ent = res->readdirp3res_u.resok.reply.entries;
910  while (ent) {
911  next = ent->nextentry;
912  GF_FREE(ent->name);
914  GF_FREE(ent);
915  ent = next;
916  }
917 
918  return;
919 }
920 
921 void
923 {
924  entry3 *ent = NULL;
925  entry3 *next = NULL;
926 
927  if (!res)
928  return;
929 
930  ent = res->readdir3res_u.resok.reply.entries;
931  while (ent) {
932  next = ent->nextentry;
933  GF_FREE(ent->name);
934  GF_FREE(ent);
935  ent = next;
936  }
937 
938  return;
939 }
940 
941 void
943 {
944  memset(args, 0, sizeof(*args));
945  args->fsroot.data.data_val = (char *)fh;
946 }
947 
948 void
949 nfs3_fill_fsstat3res(fsstat3res *res, nfsstat3 stat, struct statvfs *fsbuf,
950  struct iatt *postbuf, uint64_t deviceid)
951 {
952  post_op_attr poa;
953  fsstat3resok resok;
954 
955  memset(res, 0, sizeof(*res));
956  res->status = stat;
957  if (stat != NFS3_OK)
958  return;
959 
960  nfs3_map_deviceid_to_statdev(postbuf, deviceid);
961  poa = nfs3_stat_to_post_op_attr(postbuf);
962  resok.tbytes = (size3)(fsbuf->f_frsize * fsbuf->f_blocks);
963  resok.fbytes = (size3)(fsbuf->f_frsize * fsbuf->f_bfree);
964  resok.abytes = (size3)(fsbuf->f_frsize * fsbuf->f_bavail);
965  resok.tfiles = (size3)(fsbuf->f_files);
966  resok.ffiles = (size3)(fsbuf->f_ffree);
967  resok.afiles = (size3)(fsbuf->f_favail);
968  resok.invarsec = 0;
969 
970  resok.obj_attributes = poa;
971  res->fsstat3res_u.resok = resok;
972 }
973 
974 int32_t
975 nfs3_sattr3_to_setattr_valid(sattr3 *sattr, struct iatt *buf, mode_t *omode)
976 {
977  int32_t valid = 0;
978  ia_prot_t prot = {
979  0,
980  };
981  mode_t mode = 0;
982 
983  if (!sattr)
984  return 0;
985 
986  if (sattr->mode.set_it) {
987  valid |= GF_SET_ATTR_MODE;
988 
989  if (sattr->mode.set_mode3_u.mode & NFS3MODE_ROWNER) {
990  mode |= S_IRUSR;
991  prot.owner.read = 1;
992  }
993  if (sattr->mode.set_mode3_u.mode & NFS3MODE_WOWNER) {
994  mode |= S_IWUSR;
995  prot.owner.write = 1;
996  }
997  if (sattr->mode.set_mode3_u.mode & NFS3MODE_XOWNER) {
998  mode |= S_IXUSR;
999  prot.owner.exec = 1;
1000  }
1001 
1002  if (sattr->mode.set_mode3_u.mode & NFS3MODE_RGROUP) {
1003  mode |= S_IRGRP;
1004  prot.group.read = 1;
1005  }
1006  if (sattr->mode.set_mode3_u.mode & NFS3MODE_WGROUP) {
1007  mode |= S_IWGRP;
1008  prot.group.write = 1;
1009  }
1010  if (sattr->mode.set_mode3_u.mode & NFS3MODE_XGROUP) {
1011  mode |= S_IXGRP;
1012  prot.group.exec = 1;
1013  }
1014 
1015  if (sattr->mode.set_mode3_u.mode & NFS3MODE_ROTHER) {
1016  mode |= S_IROTH;
1017  prot.other.read = 1;
1018  }
1019  if (sattr->mode.set_mode3_u.mode & NFS3MODE_WOTHER) {
1020  mode |= S_IWOTH;
1021  prot.other.write = 1;
1022  }
1023  if (sattr->mode.set_mode3_u.mode & NFS3MODE_XOTHER) {
1024  mode |= S_IXOTH;
1025  prot.other.exec = 1;
1026  }
1027 
1028  if (sattr->mode.set_mode3_u.mode & NFS3MODE_SETXUID) {
1029  mode |= S_ISUID;
1030  prot.suid = 1;
1031  }
1032  if (sattr->mode.set_mode3_u.mode & NFS3MODE_SETXGID) {
1033  mode |= S_ISGID;
1034  prot.sgid = 1;
1035  }
1036  if (sattr->mode.set_mode3_u.mode & NFS3MODE_SAVESWAPTXT) {
1037  mode |= S_ISVTX;
1038  prot.sticky = 1;
1039  }
1040 
1041  if (buf)
1042  buf->ia_prot = prot;
1043  /* Create fop still requires the old mode_t style argument. */
1044  if (omode)
1045  *omode = mode;
1046  }
1047 
1048  if (sattr->uid.set_it) {
1049  valid |= GF_SET_ATTR_UID;
1050  if (buf)
1051  buf->ia_uid = sattr->uid.set_uid3_u.uid;
1052  }
1053 
1054  if (sattr->gid.set_it) {
1055  valid |= GF_SET_ATTR_GID;
1056  if (buf)
1057  buf->ia_gid = sattr->gid.set_gid3_u.gid;
1058  }
1059 
1060  if (sattr->size.set_it) {
1061  valid |= GF_SET_ATTR_SIZE;
1062  if (buf)
1063  buf->ia_size = sattr->size.set_size3_u.size;
1064  }
1065 
1066  if (sattr->atime.set_it == SET_TO_CLIENT_TIME) {
1067  valid |= GF_SET_ATTR_ATIME;
1068  if (buf)
1069  buf->ia_atime = sattr->atime.set_atime_u.atime.seconds;
1070  }
1071 
1072  if (sattr->atime.set_it == SET_TO_SERVER_TIME) {
1073  valid |= GF_SET_ATTR_ATIME;
1074  if (buf)
1075  buf->ia_atime = time(NULL);
1076  }
1077 
1078  if (sattr->mtime.set_it == SET_TO_CLIENT_TIME) {
1079  valid |= GF_SET_ATTR_MTIME;
1080  if (buf)
1081  buf->ia_mtime = sattr->mtime.set_mtime_u.mtime.seconds;
1082  }
1083 
1084  if (sattr->mtime.set_it == SET_TO_SERVER_TIME) {
1085  valid |= GF_SET_ATTR_MTIME;
1086  if (buf)
1087  buf->ia_mtime = time(NULL);
1088  }
1089 
1090  return valid;
1091 }
1092 
1093 wcc_data
1094 nfs3_stat_to_wcc_data(struct iatt *pre, struct iatt *post)
1095 {
1096  wcc_data wd = {
1097  {0},
1098  };
1099 
1100  if (post)
1101  wd.after = nfs3_stat_to_post_op_attr(post);
1102  if (pre)
1103  wd.before = nfs3_stat_to_pre_op_attr(pre);
1104 
1105  return wd;
1106 }
1107 
1108 void
1110  struct iatt *newbuf, struct iatt *preparent,
1111  struct iatt *postparent, uint64_t deviceid)
1112 {
1113  post_op_attr poa = {
1114  0,
1115  };
1116  wcc_data dirwcc = {
1117  {0},
1118  };
1119 
1120  memset(res, 0, sizeof(*res));
1121  res->status = stat;
1122  if (stat != NFS3_OK)
1123  return;
1124 
1126  nfs3_map_deviceid_to_statdev(newbuf, deviceid);
1127  poa = nfs3_stat_to_post_op_attr(newbuf);
1128  res->create3res_u.resok.obj_attributes = poa;
1129  nfs3_map_deviceid_to_statdev(preparent, deviceid);
1130  nfs3_map_deviceid_to_statdev(postparent, deviceid);
1131  dirwcc = nfs3_stat_to_wcc_data(preparent, postparent);
1132 
1133  res->create3res_u.resok.dir_wcc = dirwcc;
1134 }
1135 
1136 void
1138 {
1139  memset(args, 0, sizeof(*args));
1140  args->where.dir.data.data_val = (void *)fh;
1141  args->where.name = name;
1142 }
1143 
1144 void
1146 {
1147  memset(args, 0, sizeof(*args));
1148  args->object.data.data_val = (void *)fh;
1149 }
1150 
1151 void
1153  struct iatt *postop, uint64_t deviceid)
1154 {
1155  wcc_data wcc;
1156  memset(res, 0, sizeof(*res));
1157  res->status = stat;
1158  if (stat != NFS3_OK)
1159  return;
1160 
1161  nfs3_map_deviceid_to_statdev(preop, deviceid);
1162  nfs3_map_deviceid_to_statdev(postop, deviceid);
1163  wcc = nfs3_stat_to_wcc_data(preop, postop);
1164  res->setattr3res_u.resok.obj_wcc = wcc;
1165 }
1166 
1167 void
1169 {
1170  memset(args, 0, sizeof(*args));
1171  args->where.dir.data.data_val = (void *)dirfh;
1172  args->where.name = name;
1173 }
1174 
1175 void
1177  struct iatt *buf, struct iatt *preparent,
1178  struct iatt *postparent, uint64_t deviceid)
1179 {
1180  wcc_data dirwcc;
1181  post_op_attr poa;
1182 
1183  memset(res, 0, sizeof(*res));
1184  res->status = stat;
1185  if (stat != NFS3_OK)
1186  return;
1187 
1189  nfs3_map_deviceid_to_statdev(buf, deviceid);
1190  poa = nfs3_stat_to_post_op_attr(buf);
1191  nfs3_map_deviceid_to_statdev(preparent, deviceid);
1192  nfs3_map_deviceid_to_statdev(postparent, deviceid);
1193  dirwcc = nfs3_stat_to_wcc_data(preparent, postparent);
1194  res->mkdir3res_u.resok.obj_attributes = poa;
1195  res->mkdir3res_u.resok.dir_wcc = dirwcc;
1196 }
1197 
1198 void
1200  char *target)
1201 {
1202  memset(args, 0, sizeof(*args));
1203  args->where.dir.data.data_val = (void *)dirfh;
1204  args->where.name = name;
1205  args->symlink.symlink_data = target;
1206 }
1207 
1208 void
1210  struct iatt *buf, struct iatt *preparent,
1211  struct iatt *postparent, uint64_t deviceid)
1212 {
1213  wcc_data dirwcc;
1214  post_op_attr poa;
1215 
1216  memset(res, 0, sizeof(*res));
1217  res->status = stat;
1218  if (stat != NFS3_OK)
1219  return;
1220 
1222  nfs3_map_deviceid_to_statdev(buf, deviceid);
1223  poa = nfs3_stat_to_post_op_attr(buf);
1224  nfs3_map_deviceid_to_statdev(postparent, deviceid);
1225  nfs3_map_deviceid_to_statdev(preparent, deviceid);
1226  dirwcc = nfs3_stat_to_wcc_data(preparent, postparent);
1227  res->symlink3res_u.resok.obj_attributes = poa;
1228  res->symlink3res_u.resok.dir_wcc = dirwcc;
1229 }
1230 
1231 void
1233 {
1234  memset(args, 0, sizeof(*args));
1235  args->symlink.data.data_val = (void *)fh;
1236 }
1237 
1238 void
1240  struct iatt *buf, uint64_t deviceid)
1241 {
1242  post_op_attr poa;
1243 
1244  memset(res, 0, sizeof(*res));
1245  res->status = stat;
1246 
1247  if (stat != NFS3_OK)
1248  return;
1249 
1250  nfs3_map_deviceid_to_statdev(buf, deviceid);
1251  poa = nfs3_stat_to_post_op_attr(buf);
1252  res->readlink3res_u.resok.data = (void *)path;
1254 }
1255 
1256 void
1258 {
1259  memset(args, 0, sizeof(*args));
1260  args->where.dir.data.data_val = (void *)fh;
1261  args->where.name = name;
1262 }
1263 
1264 void
1266  struct iatt *buf, struct iatt *preparent,
1267  struct iatt *postparent, uint64_t deviceid)
1268 {
1269  post_op_attr poa;
1270  wcc_data wccdir;
1271 
1272  memset(res, 0, sizeof(*res));
1273  res->status = stat;
1274  if (stat != NFS3_OK)
1275  return;
1276 
1278  nfs3_map_deviceid_to_statdev(buf, deviceid);
1279  poa = nfs3_stat_to_post_op_attr(buf);
1280  nfs3_map_deviceid_to_statdev(preparent, deviceid);
1281  nfs3_map_deviceid_to_statdev(postparent, deviceid);
1282  wccdir = nfs3_stat_to_wcc_data(preparent, postparent);
1283  res->mknod3res_u.resok.obj_attributes = poa;
1284  res->mknod3res_u.resok.dir_wcc = wccdir;
1285 }
1286 
1287 void
1288 nfs3_fill_remove3res(remove3res *res, nfsstat3 stat, struct iatt *preparent,
1289  struct iatt *postparent, uint64_t deviceid)
1290 {
1291  wcc_data dirwcc;
1292 
1293  memset(res, 0, sizeof(*res));
1294  res->status = stat;
1295  if (stat != NFS3_OK)
1296  return;
1297 
1298  nfs3_map_deviceid_to_statdev(preparent, deviceid);
1299  nfs3_map_deviceid_to_statdev(postparent, deviceid);
1300  dirwcc = nfs3_stat_to_wcc_data(preparent, postparent);
1301  res->remove3res_u.resok.dir_wcc = dirwcc;
1302 }
1303 
1304 void
1306 {
1307  memset(args, 0, sizeof(*args));
1308  args->object.dir.data.data_val = (void *)fh;
1309  args->object.name = name;
1310 }
1311 
1312 void
1314 {
1315  memset(args, 0, sizeof(*args));
1316  args->object.dir.data.data_val = (void *)fh;
1317  args->object.name = name;
1318 }
1319 
1320 void
1321 nfs3_fill_rmdir3res(rmdir3res *res, nfsstat3 stat, struct iatt *preparent,
1322  struct iatt *postparent, uint64_t deviceid)
1323 {
1324  wcc_data dirwcc;
1325  memset(res, 0, sizeof(*res));
1326  res->status = stat;
1327 
1328  if (stat != NFS3_OK)
1329  return;
1330 
1331  nfs3_map_deviceid_to_statdev(postparent, deviceid);
1332  nfs3_map_deviceid_to_statdev(preparent, deviceid);
1333  dirwcc = nfs3_stat_to_wcc_data(preparent, postparent);
1334  res->rmdir3res_u.resok.dir_wcc = dirwcc;
1335 }
1336 
1337 void
1339  struct nfs3_fh *dirfh, char *name)
1340 {
1341  memset(args, 0, sizeof(*args));
1342  args->file.data.data_val = (void *)target;
1343  args->link.dir.data.data_val = (void *)dirfh;
1344  args->link.name = name;
1345 }
1346 
1347 void
1348 nfs3_fill_link3res(link3res *res, nfsstat3 stat, struct iatt *buf,
1349  struct iatt *preparent, struct iatt *postparent,
1350  uint64_t deviceid)
1351 {
1352  post_op_attr poa;
1353  wcc_data dirwcc;
1354 
1355  memset(res, 0, sizeof(*res));
1356  res->status = stat;
1357  if (stat != NFS3_OK)
1358  return;
1359 
1360  nfs3_map_deviceid_to_statdev(preparent, deviceid);
1361  nfs3_map_deviceid_to_statdev(postparent, deviceid);
1362  nfs3_map_deviceid_to_statdev(buf, deviceid);
1363  poa = nfs3_stat_to_post_op_attr(buf);
1364  dirwcc = nfs3_stat_to_wcc_data(preparent, postparent);
1365  res->link3res_u.resok.file_attributes = poa;
1366  res->link3res_u.resok.linkdir_wcc = dirwcc;
1367 }
1368 
1369 void
1371  char *oldname, struct nfs3_fh *newdirfh, char *newname)
1372 {
1373  memset(args, 0, sizeof(*args));
1374 
1375  args->from.name = oldname;
1376  args->from.dir.data.data_val = (void *)olddirfh;
1377  args->to.name = newname;
1378  args->to.dir.data.data_val = (void *)newdirfh;
1379 }
1380 
1381 void
1383  struct iatt *preoldparent, struct iatt *postoldparent,
1384  struct iatt *prenewparent, struct iatt *postnewparent,
1385  uint64_t deviceid)
1386 
1387 {
1388  wcc_data dirwcc;
1389 
1390  memset(res, 0, sizeof(*res));
1391  res->status = stat;
1392  if (stat != NFS3_OK)
1393  return;
1394 
1395  nfs3_map_deviceid_to_statdev(preoldparent, deviceid);
1396  nfs3_map_deviceid_to_statdev(postoldparent, deviceid);
1397  nfs3_map_deviceid_to_statdev(prenewparent, deviceid);
1398  nfs3_map_deviceid_to_statdev(postnewparent, deviceid);
1399  nfs3_map_deviceid_to_statdev(buf, deviceid);
1400  dirwcc = nfs3_stat_to_wcc_data(preoldparent, postoldparent);
1401  res->rename3res_u.resok.fromdir_wcc = dirwcc;
1402  dirwcc = nfs3_stat_to_wcc_data(prenewparent, postnewparent);
1403  res->rename3res_u.resok.todir_wcc = dirwcc;
1404 }
1405 
1406 void
1408 {
1409  memset(args, 0, sizeof(*args));
1410  args->file.data.data_val = (void *)fh;
1411 }
1412 
1413 void
1415  stable_how stable, uint64_t wverf, struct iatt *prestat,
1416  struct iatt *poststat, uint64_t deviceid)
1417 {
1418  write3resok resok;
1419  memset(res, 0, sizeof(*res));
1420  res->status = stat;
1421  if (stat != NFS3_OK)
1422  return;
1423 
1424  nfs3_map_deviceid_to_statdev(prestat, deviceid);
1425  nfs3_map_deviceid_to_statdev(poststat, deviceid);
1426  resok.file_wcc = nfs3_stat_to_wcc_data(prestat, poststat);
1427  resok.count = count;
1428  resok.committed = stable;
1429  memcpy(resok.verf, &wverf, sizeof(wverf));
1430 
1431  res->write3res_u.resok = resok;
1432 }
1433 
1434 void
1436 {
1437  memset(args, 0, sizeof(*args));
1438  args->file.data.data_val = (void *)fh;
1439 }
1440 
1441 void
1442 nfs3_fill_commit3res(commit3res *res, nfsstat3 stat, uint64_t wverf,
1443  struct iatt *prestat, struct iatt *poststat,
1444  uint64_t deviceid)
1445 {
1446  memset(res, 0, sizeof(*res));
1447  res->status = stat;
1448  if (stat != NFS3_OK)
1449  return;
1450 
1451  nfs3_map_deviceid_to_statdev(poststat, deviceid);
1452  nfs3_map_deviceid_to_statdev(prestat, deviceid);
1453  res->commit3res_u.resok.file_wcc = nfs3_stat_to_wcc_data(prestat, poststat);
1454  memcpy(res->commit3res_u.resok.verf, &wverf, sizeof(wverf));
1455 }
1456 
1457 void
1459  struct iatt *poststat, int is_eof, uint64_t deviceid)
1460 {
1461  post_op_attr poa;
1462 
1463  memset(res, 0, sizeof(*res));
1464  res->status = stat;
1465  if (stat != NFS3_OK)
1466  return;
1467 
1468  nfs3_map_deviceid_to_statdev(poststat, deviceid);
1469  poa = nfs3_stat_to_post_op_attr(poststat);
1470  res->read3res_u.resok.file_attributes = poa;
1471  res->read3res_u.resok.count = count;
1472  res->read3res_u.resok.eof = is_eof;
1473  res->read3res_u.resok.data.data_len = count;
1474 }
1475 
1476 void
1478 {
1479  memset(args, 0, sizeof(*args));
1480  args->file.data.data_val = (void *)fh;
1481 }
1482 
1483 void
1485  uint64_t deviceid)
1486 {
1487  pathconf3resok resok;
1488 
1489  memset(res, 0, sizeof(*res));
1490  res->status = stat;
1491  if (stat != NFS3_OK)
1492  return;
1493 
1494  nfs3_map_deviceid_to_statdev(buf, deviceid);
1496  resok.linkmax = 256;
1497  resok.name_max = NFS_NAME_MAX;
1498  resok.no_trunc = TRUE;
1499  resok.chown_restricted = FALSE;
1500  resok.case_insensitive = FALSE;
1501  resok.case_preserving = TRUE;
1502 
1503  res->pathconf3res_u.resok = resok;
1504 }
1505 
1506 void
1508 {
1509  memset(args, 0, sizeof(*args));
1510  args->object.data.data_val = (void *)fh;
1511 }
1512 
1513 int
1514 nfs3_verify_dircookie(struct nfs3_state *nfs3, fd_t *dirfd, cookie3 cookie,
1515  uint64_t cverf, nfsstat3 *stat)
1516 {
1517  int ret = -1;
1518 
1519  if ((!nfs3) || (!dirfd))
1520  return -1;
1521 
1522  /* Can assume that this is first read on the dir, so cookie check
1523  * is successful by default.
1524  */
1525  if (cookie == 0)
1526  return 0;
1527 
1528  gf_msg_trace(GF_NFS3, 0,
1529  "Verifying cookie: cverf: %" PRIu64 ", cookie: %" PRIu64,
1530  cverf, cookie);
1531  /* The cookie bad, no way cverf will be zero with a non-zero cookie. */
1532  if ((cverf == 0) && (cookie != 0)) {
1533  gf_msg_trace(GF_NFS3, 0, "Bad cookie requested");
1534  if (stat)
1535  *stat = NFS3ERR_BAD_COOKIE;
1536  goto err;
1537  }
1538 
1539  /* Yes, its true, our cookie is simply the fd_t address.
1540  * NOTE: We used have the check for cookieverf but VMWare client sends
1541  * a readdirp requests even after we've told it that EOF has been
1542  * reached on the directory. This causes a problem because we close a
1543  * dir fd_t after reaching EOF. The next readdirp sent by VMWare
1544  * contains the address of the closed fd_t as cookieverf. Since we
1545  * closed that fd_t, this readdirp results in a new opendir which will
1546  * give an fd_t that will fail this check below.
1547  */
1548  /* if ((cverf != (uint64_t)dirfd)) {
1549  gf_log (GF_NFS3, GF_LOG_TRACE, "Cookieverf does not match");
1550  if (stat)
1551  *stat = NFS3ERR_BAD_COOKIE;
1552  goto err;
1553  }
1554  */
1555  gf_msg_trace(GF_NFS3, 0, "Cookie verified");
1556  if (stat)
1557  *stat = NFS3_OK;
1558  ret = 0;
1559 err:
1560  return ret;
1561 }
1562 
1563 void
1564 nfs3_stat_to_errstr(uint32_t xid, char *op, nfsstat3 stat, int pstat,
1565  char *errstr, size_t len)
1566 {
1567  if ((!op) || (!errstr))
1568  return;
1569 
1570  snprintf(errstr, len, "XID: %x, %s: NFS: %d(%s), POSIX: %d(%s)", xid, op,
1571  stat, nfsstat3_strerror(stat), pstat, strerror(pstat));
1572 }
1573 
1574 void
1575 nfs3_log_common_call(uint32_t xid, char *op, struct nfs3_fh *fh)
1576 {
1577  char fhstr[1024];
1578 
1579  if (THIS->ctx->log.loglevel < GF_LOG_DEBUG)
1580  return;
1581 
1582  nfs3_fh_to_str(fh, fhstr, sizeof(fhstr));
1583  gf_msg_debug(GF_NFS3, 0, "XID: %x, %s: args: %s", xid, op, fhstr);
1584 }
1585 
1586 void
1587 nfs3_log_fh_entry_call(uint32_t xid, char *op, struct nfs3_fh *fh, char *name)
1588 {
1589  char fhstr[1024];
1590 
1591  if (THIS->ctx->log.loglevel < GF_LOG_DEBUG)
1592  return;
1593  nfs3_fh_to_str(fh, fhstr, sizeof(fhstr));
1594  gf_msg_debug(GF_NFS3, 0, "XID: %x, %s: args: %s, name: %s", xid, op, fhstr,
1595  name);
1596 }
1597 
1598 void
1599 nfs3_log_rename_call(uint32_t xid, struct nfs3_fh *src, char *sname,
1600  struct nfs3_fh *dst, char *dname)
1601 {
1602  char sfhstr[1024];
1603  char dfhstr[1024];
1604 
1605  if (THIS->ctx->log.loglevel < GF_LOG_DEBUG)
1606  return;
1607  nfs3_fh_to_str(src, sfhstr, sizeof(sfhstr));
1608  nfs3_fh_to_str(dst, dfhstr, sizeof(dfhstr));
1609  gf_msg_debug(GF_NFS3, 0,
1610  "XID: %x, RENAME: args: Src: %s, "
1611  "name: %s, Dst: %s, name: %s",
1612  xid, sfhstr, sname, dfhstr, dname);
1613 }
1614 
1615 void
1616 nfs3_log_create_call(uint32_t xid, struct nfs3_fh *fh, char *name,
1617  createmode3 mode)
1618 {
1619  char fhstr[1024];
1620  char *modestr = NULL;
1621  char exclmode[] = "EXCLUSIVE";
1622  char unchkd[] = "UNCHECKED";
1623  char guarded[] = "GUARDED";
1624 
1625  if (THIS->ctx->log.loglevel < GF_LOG_DEBUG)
1626  return;
1627  nfs3_fh_to_str(fh, fhstr, sizeof(fhstr));
1628  if (mode == EXCLUSIVE)
1629  modestr = exclmode;
1630  else if (mode == GUARDED)
1631  modestr = guarded;
1632  else
1633  modestr = unchkd;
1634 
1635  gf_msg_debug(GF_NFS3, 0,
1636  "XID: %x, CREATE: args: %s, name: %s,"
1637  " mode: %s",
1638  xid, fhstr, name, modestr);
1639 }
1640 
1641 void
1642 nfs3_log_mknod_call(uint32_t xid, struct nfs3_fh *fh, char *name, int type)
1643 {
1644  char fhstr[1024];
1645  char *modestr = NULL;
1646  char chr[] = "CHAR";
1647  char blk[] = "BLK";
1648  char sock[] = "SOCK";
1649  char fifo[] = "FIFO";
1650 
1651  if (THIS->ctx->log.loglevel < GF_LOG_DEBUG)
1652  return;
1653  nfs3_fh_to_str(fh, fhstr, sizeof(fhstr));
1654  if (type == NF3CHR)
1655  modestr = chr;
1656  else if (type == NF3BLK)
1657  modestr = blk;
1658  else if (type == NF3SOCK)
1659  modestr = sock;
1660  else
1661  modestr = fifo;
1662 
1663  gf_msg_debug(GF_NFS3, 0,
1664  "XID: %x, MKNOD: args: %s, name: %s,"
1665  " type: %s",
1666  xid, fhstr, name, modestr);
1667 }
1668 
1669 void
1670 nfs3_log_symlink_call(uint32_t xid, struct nfs3_fh *fh, char *name, char *tgt)
1671 {
1672  char fhstr[1024];
1673 
1674  if (THIS->ctx->log.loglevel < GF_LOG_DEBUG)
1675  return;
1676  nfs3_fh_to_str(fh, fhstr, sizeof(fhstr));
1677  gf_msg_debug(GF_NFS3, 0,
1678  "XID: %x, SYMLINK: args: %s, name: %s,"
1679  " target: %s",
1680  xid, fhstr, name, tgt);
1681 }
1682 
1683 void
1684 nfs3_log_link_call(uint32_t xid, struct nfs3_fh *fh, char *name,
1685  struct nfs3_fh *tgt)
1686 {
1687  char dfhstr[1024];
1688  char tfhstr[1024];
1689 
1690  if (THIS->ctx->log.loglevel < GF_LOG_DEBUG)
1691  return;
1692  nfs3_fh_to_str(fh, dfhstr, sizeof(dfhstr));
1693  nfs3_fh_to_str(tgt, tfhstr, sizeof(tfhstr));
1694  gf_msg_debug(GF_NFS3, 0,
1695  "XID: %x, LINK: args: %s, name: %s,"
1696  " target: %s",
1697  xid, dfhstr, name, tfhstr);
1698 }
1699 
1700 void
1701 nfs3_log_rw_call(uint32_t xid, char *op, struct nfs3_fh *fh, offset3 offt,
1702  count3 count, int stablewrite)
1703 {
1704  char fhstr[1024];
1705 
1706  if (THIS->ctx->log.loglevel < GF_LOG_DEBUG)
1707  return;
1708  nfs3_fh_to_str(fh, fhstr, sizeof(fhstr));
1709  if (stablewrite == -1)
1710  gf_msg_debug(GF_NFS3, 0,
1711  "XID: %x, %s: args: %s, offset:"
1712  " %" PRIu64 ", count: %" PRIu32,
1713  xid, op, fhstr, offt, count);
1714  else
1715  gf_msg_debug(GF_NFS3, 0,
1716  "XID: %x, %s: args: %s, offset:"
1717  " %" PRIu64 ", count: %" PRIu32 ", %s",
1718  xid, op, fhstr, offt, count,
1719  (stablewrite == UNSTABLE) ? "UNSTABLE" : "STABLE");
1720 }
1721 
1722 int
1724 {
1725  int ll = GF_LOG_DEBUG;
1726 
1727  switch (stat) {
1728  case NFS3ERR_PERM:
1729  ll = GF_LOG_WARNING;
1730  break;
1731 
1732  case NFS3ERR_NOENT:
1733  ll = GF_LOG_WARNING;
1734  break;
1735 
1736  case NFS3ERR_ACCES:
1737  ll = GF_LOG_WARNING;
1738  break;
1739 
1740  case NFS3ERR_EXIST:
1741  ll = GF_LOG_WARNING;
1742  break;
1743 
1744  case NFS3ERR_XDEV:
1745  ll = GF_LOG_WARNING;
1746  break;
1747 
1748  case NFS3ERR_NODEV:
1749  ll = GF_LOG_WARNING;
1750  break;
1751 
1752  case NFS3ERR_IO:
1753  ll = GF_LOG_WARNING;
1754  break;
1755 
1756  case NFS3ERR_NXIO:
1757  ll = GF_LOG_WARNING;
1758  break;
1759 
1760  case NFS3ERR_NOTDIR:
1761  ll = GF_LOG_WARNING;
1762  break;
1763 
1764  case NFS3ERR_ISDIR:
1765  ll = GF_LOG_WARNING;
1766  break;
1767 
1768  case NFS3ERR_INVAL:
1769  ll = GF_LOG_WARNING;
1770  break;
1771 
1772  case NFS3ERR_NOSPC:
1773  ll = GF_LOG_WARNING;
1774  break;
1775 
1776  case NFS3ERR_ROFS:
1777  ll = GF_LOG_WARNING;
1778  break;
1779 
1780  case NFS3ERR_FBIG:
1781  ll = GF_LOG_WARNING;
1782  break;
1783 
1784  case NFS3ERR_MLINK:
1785  ll = GF_LOG_WARNING;
1786  break;
1787 
1788  case NFS3ERR_NAMETOOLONG:
1789  ll = GF_LOG_WARNING;
1790  break;
1791 
1792  case NFS3ERR_NOTEMPTY:
1793  ll = GF_LOG_WARNING;
1794  break;
1795 
1796  case NFS3ERR_SERVERFAULT:
1797  ll = GF_LOG_WARNING;
1798  break;
1799 
1800  case NFS3ERR_NOTSUPP:
1801  ll = GF_LOG_WARNING;
1802  break;
1803 
1804  case NFS3ERR_BADHANDLE:
1805  ll = GF_LOG_WARNING;
1806  break;
1807 
1808  case NFS3ERR_STALE:
1809  ll = GF_LOG_WARNING;
1810  break;
1811 
1812  case NFS3ERR_DQUOT:
1813  ll = GF_LOG_WARNING;
1814  break;
1815 
1816  default:
1817  ll = GF_LOG_DEBUG;
1818  break;
1819  }
1820 
1821  return ll;
1822 }
1823 
1824 int
1826 {
1827  int ll = GF_LOG_DEBUG;
1828 
1829  switch (stat) {
1830  case NFS3ERR_NOENT:
1831  ll = GF_LOG_WARNING;
1832  break;
1833 
1834  case NFS3ERR_EXIST:
1835  ll = GF_LOG_WARNING;
1836  break;
1837 
1838  case NFS3ERR_XDEV:
1839  ll = GF_LOG_WARNING;
1840  break;
1841 
1842  case NFS3ERR_NODEV:
1843  ll = GF_LOG_WARNING;
1844  break;
1845 
1846  case NFS3ERR_IO:
1847  ll = GF_LOG_WARNING;
1848  break;
1849 
1850  case NFS3ERR_NXIO:
1851  ll = GF_LOG_WARNING;
1852  break;
1853 
1854  case NFS3ERR_NOTDIR:
1855  ll = GF_LOG_WARNING;
1856  break;
1857 
1858  case NFS3ERR_ISDIR:
1859  ll = GF_LOG_WARNING;
1860  break;
1861 
1862  case NFS3ERR_INVAL:
1863  ll = GF_LOG_WARNING;
1864  break;
1865 
1866  case NFS3ERR_NOSPC:
1867  ll = GF_LOG_WARNING;
1868  break;
1869 
1870  case NFS3ERR_ROFS:
1871  ll = GF_LOG_WARNING;
1872  break;
1873 
1874  case NFS3ERR_FBIG:
1875  ll = GF_LOG_WARNING;
1876  break;
1877 
1878  case NFS3ERR_MLINK:
1879  ll = GF_LOG_WARNING;
1880  break;
1881 
1882  case NFS3ERR_NAMETOOLONG:
1883  ll = GF_LOG_WARNING;
1884  break;
1885 
1886  case NFS3ERR_NOTEMPTY:
1887  ll = GF_LOG_WARNING;
1888  break;
1889 
1890  case NFS3ERR_SERVERFAULT:
1891  ll = GF_LOG_WARNING;
1892  break;
1893 
1894  case NFS3ERR_NOTSUPP:
1895  ll = GF_LOG_WARNING;
1896  break;
1897 
1898  case NFS3ERR_BADHANDLE:
1899  ll = GF_LOG_WARNING;
1900  break;
1901 
1902  case NFS3ERR_STALE:
1903  ll = GF_LOG_WARNING;
1904  break;
1905 
1906  case NFS3ERR_DQUOT:
1907  ll = GF_LOG_WARNING;
1908  break;
1909 
1910  default:
1911  ll = GF_LOG_DEBUG;
1912  break;
1913  }
1914 
1915  return ll;
1916 }
1917 
1918 int
1920 {
1921  int ll = GF_LOG_DEBUG;
1922 
1923  switch (stat) {
1924  case NFS3ERR_PERM:
1925  ll = GF_LOG_WARNING;
1926  break;
1927 
1928  case NFS3ERR_ACCES:
1929  ll = GF_LOG_WARNING;
1930  break;
1931 
1932  case NFS3ERR_EXIST:
1933  ll = GF_LOG_WARNING;
1934  break;
1935 
1936  case NFS3ERR_XDEV:
1937  ll = GF_LOG_WARNING;
1938  break;
1939 
1940  case NFS3ERR_NODEV:
1941  ll = GF_LOG_WARNING;
1942  break;
1943 
1944  case NFS3ERR_IO:
1945  ll = GF_LOG_WARNING;
1946  break;
1947 
1948  case NFS3ERR_NXIO:
1949  ll = GF_LOG_WARNING;
1950  break;
1951 
1952  case NFS3ERR_NOTDIR:
1953  ll = GF_LOG_WARNING;
1954  break;
1955 
1956  case NFS3ERR_ISDIR:
1957  ll = GF_LOG_WARNING;
1958  break;
1959 
1960  case NFS3ERR_INVAL:
1961  ll = GF_LOG_WARNING;
1962  break;
1963 
1964  case NFS3ERR_NOSPC:
1965  ll = GF_LOG_WARNING;
1966  break;
1967 
1968  case NFS3ERR_ROFS:
1969  ll = GF_LOG_WARNING;
1970  break;
1971 
1972  case NFS3ERR_FBIG:
1973  ll = GF_LOG_WARNING;
1974  break;
1975 
1976  case NFS3ERR_MLINK:
1977  ll = GF_LOG_WARNING;
1978  break;
1979 
1980  case NFS3ERR_NAMETOOLONG:
1981  ll = GF_LOG_WARNING;
1982  break;
1983 
1984  case NFS3ERR_NOTEMPTY:
1985  ll = GF_LOG_WARNING;
1986  break;
1987 
1988  case NFS3ERR_SERVERFAULT:
1989  ll = GF_LOG_WARNING;
1990  break;
1991 
1992  case NFS3ERR_NOTSUPP:
1993  ll = GF_LOG_WARNING;
1994  break;
1995 
1996  case NFS3ERR_BADHANDLE:
1997  ll = GF_LOG_WARNING;
1998  break;
1999 
2000  case NFS3ERR_STALE:
2001  ll = GF_LOG_WARNING;
2002  break;
2003 
2004  case NFS3ERR_DQUOT:
2005  ll = GF_LOG_WARNING;
2006  break;
2007 
2008  default:
2009  ll = GF_LOG_DEBUG;
2010  break;
2011  }
2012 
2013  return ll;
2014 }
2015 
2016 int
2018 {
2019  int ll = GF_LOG_DEBUG;
2020 
2021  switch (stat) {
2022  case NFS3ERR_NOENT:
2023  ll = GF_LOG_WARNING;
2024  break;
2025 
2026  case NFS3ERR_EXIST:
2027  ll = GF_LOG_WARNING;
2028  break;
2029 
2030  case NFS3ERR_XDEV:
2031  ll = GF_LOG_WARNING;
2032  break;
2033 
2034  case NFS3ERR_NODEV:
2035  ll = GF_LOG_WARNING;
2036  break;
2037 
2038  case NFS3ERR_IO:
2039  ll = GF_LOG_WARNING;
2040  break;
2041 
2042  case NFS3ERR_NXIO:
2043  ll = GF_LOG_WARNING;
2044  break;
2045 
2046  case NFS3ERR_NOTDIR:
2047  ll = GF_LOG_WARNING;
2048  break;
2049 
2050  case NFS3ERR_ISDIR:
2051  ll = GF_LOG_WARNING;
2052  break;
2053 
2054  case NFS3ERR_INVAL:
2055  ll = GF_LOG_WARNING;
2056  break;
2057 
2058  case NFS3ERR_NOSPC:
2059  ll = GF_LOG_WARNING;
2060  break;
2061 
2062  case NFS3ERR_ROFS:
2063  ll = GF_LOG_WARNING;
2064  break;
2065 
2066  case NFS3ERR_FBIG:
2067  ll = GF_LOG_WARNING;
2068  break;
2069 
2070  case NFS3ERR_MLINK:
2071  ll = GF_LOG_WARNING;
2072  break;
2073 
2074  case NFS3ERR_NAMETOOLONG:
2075  ll = GF_LOG_WARNING;
2076  break;
2077 
2078  case NFS3ERR_NOTEMPTY:
2079  ll = GF_LOG_WARNING;
2080  break;
2081 
2082  case NFS3ERR_SERVERFAULT:
2083  ll = GF_LOG_WARNING;
2084  break;
2085 
2086  case NFS3ERR_NOTSUPP:
2087  ll = GF_LOG_WARNING;
2088  break;
2089 
2090  case NFS3ERR_BADHANDLE:
2091  ll = GF_LOG_WARNING;
2092  break;
2093 
2094  case NFS3ERR_STALE:
2095  ll = GF_LOG_WARNING;
2096  break;
2097 
2098  case NFS3ERR_DQUOT:
2099  ll = GF_LOG_WARNING;
2100  break;
2101 
2102  default:
2103  ll = GF_LOG_DEBUG;
2104  break;
2105  }
2106 
2107  return ll;
2108 }
2109 
2110 int
2112 {
2113  int ll = GF_LOG_DEBUG;
2114 
2115  switch (stat) {
2116  case NFS3ERR_EXIST:
2117  ll = GF_LOG_WARNING;
2118  break;
2119 
2120  case NFS3ERR_XDEV:
2121  ll = GF_LOG_WARNING;
2122  break;
2123 
2124  case NFS3ERR_NODEV:
2125  ll = GF_LOG_WARNING;
2126  break;
2127 
2128  case NFS3ERR_IO:
2129  ll = GF_LOG_WARNING;
2130  break;
2131 
2132  case NFS3ERR_NXIO:
2133  ll = GF_LOG_WARNING;
2134  break;
2135 
2136  case NFS3ERR_NOTDIR:
2137  ll = GF_LOG_WARNING;
2138  break;
2139 
2140  case NFS3ERR_ISDIR:
2141  ll = GF_LOG_WARNING;
2142  break;
2143 
2144  case NFS3ERR_INVAL:
2145  ll = GF_LOG_WARNING;
2146  break;
2147 
2148  case NFS3ERR_NOSPC:
2149  ll = GF_LOG_WARNING;
2150  break;
2151 
2152  case NFS3ERR_ROFS:
2153  ll = GF_LOG_WARNING;
2154  break;
2155 
2156  case NFS3ERR_FBIG:
2157  ll = GF_LOG_WARNING;
2158  break;
2159 
2160  case NFS3ERR_MLINK:
2161  ll = GF_LOG_WARNING;
2162  break;
2163 
2164  case NFS3ERR_NOTEMPTY:
2165  ll = GF_LOG_WARNING;
2166  break;
2167 
2168  case NFS3ERR_SERVERFAULT:
2169  ll = GF_LOG_WARNING;
2170  break;
2171 
2172  case NFS3ERR_NOTSUPP:
2173  ll = GF_LOG_WARNING;
2174  break;
2175 
2176  case NFS3ERR_BADHANDLE:
2177  ll = GF_LOG_WARNING;
2178  break;
2179 
2180  case NFS3ERR_STALE:
2181  ll = GF_LOG_WARNING;
2182  break;
2183 
2184  case NFS3ERR_DQUOT:
2185  ll = GF_LOG_WARNING;
2186  break;
2187 
2188  default:
2189  ll = GF_LOG_DEBUG;
2190  break;
2191  }
2192 
2193  return ll;
2194 }
2195 
2196 int
2198 {
2199  int ll = GF_LOG_DEBUG;
2200 
2201  switch (stat) {
2202  case NFS3ERR_NOENT:
2203  ll = GF_LOG_WARNING;
2204  break;
2205 
2206  case NFS3ERR_EXIST:
2207  ll = GF_LOG_WARNING;
2208  break;
2209 
2210  case NFS3ERR_XDEV:
2211  ll = GF_LOG_WARNING;
2212  break;
2213 
2214  case NFS3ERR_NODEV:
2215  ll = GF_LOG_WARNING;
2216  break;
2217 
2218  case NFS3ERR_IO:
2219  ll = GF_LOG_WARNING;
2220  break;
2221 
2222  case NFS3ERR_NXIO:
2223  ll = GF_LOG_WARNING;
2224  break;
2225 
2226  case NFS3ERR_NOTDIR:
2227  ll = GF_LOG_WARNING;
2228  break;
2229 
2230  case NFS3ERR_ISDIR:
2231  ll = GF_LOG_WARNING;
2232  break;
2233 
2234  case NFS3ERR_INVAL:
2235  ll = GF_LOG_WARNING;
2236  break;
2237 
2238  case NFS3ERR_NOSPC:
2239  ll = GF_LOG_WARNING;
2240  break;
2241 
2242  case NFS3ERR_ROFS:
2243  ll = GF_LOG_WARNING;
2244  break;
2245 
2246  case NFS3ERR_FBIG:
2247  ll = GF_LOG_WARNING;
2248  break;
2249 
2250  case NFS3ERR_MLINK:
2251  ll = GF_LOG_WARNING;
2252  break;
2253 
2254  case NFS3ERR_NAMETOOLONG:
2255  ll = GF_LOG_WARNING;
2256  break;
2257 
2258  case NFS3ERR_NOTEMPTY:
2259  ll = GF_LOG_WARNING;
2260  break;
2261 
2262  case NFS3ERR_SERVERFAULT:
2263  ll = GF_LOG_WARNING;
2264  break;
2265 
2266  case NFS3ERR_NOTSUPP:
2267  ll = GF_LOG_WARNING;
2268  break;
2269 
2270  case NFS3ERR_BADHANDLE:
2271  ll = GF_LOG_WARNING;
2272  break;
2273 
2274  case NFS3ERR_STALE:
2275  ll = GF_LOG_WARNING;
2276  break;
2277 
2278  case NFS3ERR_DQUOT:
2279  ll = GF_LOG_WARNING;
2280  break;
2281 
2282  default:
2283  ll = GF_LOG_DEBUG;
2284  break;
2285  }
2286 
2287  return ll;
2288 }
2289 
2290 int
2292 {
2293  int ll = GF_LOG_DEBUG;
2294 
2295  switch (stat) {
2296  case NFS3ERR_NOENT:
2297  ll = GF_LOG_WARNING;
2298  break;
2299 
2300  case NFS3ERR_EXIST:
2301  ll = GF_LOG_WARNING;
2302  break;
2303 
2304  case NFS3ERR_XDEV:
2305  ll = GF_LOG_WARNING;
2306  break;
2307 
2308  case NFS3ERR_NODEV:
2309  ll = GF_LOG_WARNING;
2310  break;
2311 
2312  case NFS3ERR_IO:
2313  ll = GF_LOG_WARNING;
2314  break;
2315 
2316  case NFS3ERR_NXIO:
2317  ll = GF_LOG_WARNING;
2318  break;
2319 
2320  case NFS3ERR_NOTDIR:
2321  ll = GF_LOG_WARNING;
2322  break;
2323 
2324  case NFS3ERR_ISDIR:
2325  ll = GF_LOG_WARNING;
2326  break;
2327 
2328  case NFS3ERR_INVAL:
2329  ll = GF_LOG_WARNING;
2330  break;
2331 
2332  case NFS3ERR_NOSPC:
2333  ll = GF_LOG_WARNING;
2334  break;
2335 
2336  case NFS3ERR_ROFS:
2337  ll = GF_LOG_WARNING;
2338  break;
2339 
2340  case NFS3ERR_FBIG:
2341  ll = GF_LOG_WARNING;
2342  break;
2343 
2344  case NFS3ERR_MLINK:
2345  ll = GF_LOG_WARNING;
2346  break;
2347 
2348  case NFS3ERR_NAMETOOLONG:
2349  ll = GF_LOG_WARNING;
2350  break;
2351 
2352  case NFS3ERR_NOTEMPTY:
2353  ll = GF_LOG_WARNING;
2354  break;
2355 
2356  case NFS3ERR_SERVERFAULT:
2357  ll = GF_LOG_WARNING;
2358  break;
2359 
2360  case NFS3ERR_NOTSUPP:
2361  ll = GF_LOG_WARNING;
2362  break;
2363 
2364  case NFS3ERR_BADHANDLE:
2365  ll = GF_LOG_WARNING;
2366  break;
2367 
2368  case NFS3ERR_STALE:
2369  ll = GF_LOG_WARNING;
2370  break;
2371 
2372  case NFS3ERR_DQUOT:
2373  ll = GF_LOG_WARNING;
2374  break;
2375 
2376  default:
2377  ll = GF_LOG_DEBUG;
2378  break;
2379  }
2380 
2381  return ll;
2382 }
2383 
2384 int
2386 {
2387  int ll = GF_LOG_DEBUG;
2388 
2389  switch (stat) {
2390  case NFS3ERR_NOENT:
2391  ll = GF_LOG_WARNING;
2392  break;
2393 
2394  case NFS3ERR_EXIST:
2395  ll = GF_LOG_WARNING;
2396  break;
2397 
2398  case NFS3ERR_XDEV:
2399  ll = GF_LOG_WARNING;
2400  break;
2401 
2402  case NFS3ERR_NODEV:
2403  ll = GF_LOG_WARNING;
2404  break;
2405 
2406  case NFS3ERR_IO:
2407  ll = GF_LOG_WARNING;
2408  break;
2409 
2410  case NFS3ERR_NXIO:
2411  ll = GF_LOG_WARNING;
2412  break;
2413 
2414  case NFS3ERR_NOTDIR:
2415  ll = GF_LOG_WARNING;
2416  break;
2417 
2418  case NFS3ERR_ISDIR:
2419  ll = GF_LOG_WARNING;
2420  break;
2421 
2422  case NFS3ERR_INVAL:
2423  ll = GF_LOG_WARNING;
2424  break;
2425 
2426  case NFS3ERR_FBIG:
2427  ll = GF_LOG_WARNING;
2428  break;
2429 
2430  case NFS3ERR_MLINK:
2431  ll = GF_LOG_WARNING;
2432  break;
2433 
2434  case NFS3ERR_NOTEMPTY:
2435  ll = GF_LOG_WARNING;
2436  break;
2437 
2438  case NFS3ERR_SERVERFAULT:
2439  ll = GF_LOG_WARNING;
2440  break;
2441 
2442  case NFS3ERR_NOTSUPP:
2443  ll = GF_LOG_WARNING;
2444  break;
2445 
2446  case NFS3ERR_BADHANDLE:
2447  ll = GF_LOG_WARNING;
2448  break;
2449 
2450  case NFS3ERR_STALE:
2451  ll = GF_LOG_WARNING;
2452  break;
2453 
2454  default:
2455  ll = GF_LOG_DEBUG;
2456  break;
2457  }
2458 
2459  return ll;
2460 }
2461 
2462 int
2464 {
2465  int ll = GF_LOG_DEBUG;
2466 
2467  switch (stat) {
2468  case NFS3ERR_NOENT:
2469  ll = GF_LOG_WARNING;
2470  break;
2471 
2472  case NFS3ERR_XDEV:
2473  ll = GF_LOG_WARNING;
2474  break;
2475 
2476  case NFS3ERR_NODEV:
2477  ll = GF_LOG_WARNING;
2478  break;
2479 
2480  case NFS3ERR_IO:
2481  ll = GF_LOG_WARNING;
2482  break;
2483 
2484  case NFS3ERR_NXIO:
2485  ll = GF_LOG_WARNING;
2486  break;
2487 
2488  case NFS3ERR_NOTDIR:
2489  ll = GF_LOG_WARNING;
2490  break;
2491 
2492  case NFS3ERR_ISDIR:
2493  ll = GF_LOG_WARNING;
2494  break;
2495 
2496  case NFS3ERR_INVAL:
2497  ll = GF_LOG_WARNING;
2498  break;
2499 
2500  case NFS3ERR_FBIG:
2501  ll = GF_LOG_WARNING;
2502  break;
2503 
2504  case NFS3ERR_MLINK:
2505  ll = GF_LOG_WARNING;
2506  break;
2507 
2508  case NFS3ERR_NOTEMPTY:
2509  ll = GF_LOG_WARNING;
2510  break;
2511 
2512  case NFS3ERR_SERVERFAULT:
2513  ll = GF_LOG_WARNING;
2514  break;
2515 
2516  case NFS3ERR_NOTSUPP:
2517  ll = GF_LOG_WARNING;
2518  break;
2519 
2520  case NFS3ERR_BADHANDLE:
2521  ll = GF_LOG_WARNING;
2522  break;
2523 
2524  case NFS3ERR_STALE:
2525  ll = GF_LOG_WARNING;
2526  break;
2527 
2528  case NFS3ERR_DQUOT:
2529  ll = GF_LOG_WARNING;
2530  break;
2531 
2532  default:
2533  ll = GF_LOG_DEBUG;
2534  break;
2535  }
2536 
2537  return ll;
2538 }
2539 
2540 int
2542 {
2543  int ll = GF_LOG_DEBUG;
2544 
2545  switch (stat) {
2546  case NFS3ERR_XDEV:
2547  ll = GF_LOG_WARNING;
2548  break;
2549 
2550  case NFS3ERR_NODEV:
2551  ll = GF_LOG_WARNING;
2552  break;
2553 
2554  case NFS3ERR_IO:
2555  ll = GF_LOG_WARNING;
2556  break;
2557 
2558  case NFS3ERR_NXIO:
2559  ll = GF_LOG_WARNING;
2560  break;
2561 
2562  case NFS3ERR_NOTDIR:
2563  ll = GF_LOG_WARNING;
2564  break;
2565 
2566  case NFS3ERR_ISDIR:
2567  ll = GF_LOG_WARNING;
2568  break;
2569 
2570  case NFS3ERR_INVAL:
2571  ll = GF_LOG_WARNING;
2572  break;
2573 
2574  case NFS3ERR_FBIG:
2575  ll = GF_LOG_WARNING;
2576  break;
2577 
2578  case NFS3ERR_MLINK:
2579  ll = GF_LOG_WARNING;
2580  break;
2581 
2582  case NFS3ERR_NOTEMPTY:
2583  ll = GF_LOG_WARNING;
2584  break;
2585 
2586  case NFS3ERR_SERVERFAULT:
2587  ll = GF_LOG_WARNING;
2588  break;
2589 
2590  case NFS3ERR_NOTSUPP:
2591  ll = GF_LOG_WARNING;
2592  break;
2593 
2594  case NFS3ERR_BADHANDLE:
2595  ll = GF_LOG_WARNING;
2596  break;
2597 
2598  case NFS3ERR_STALE:
2599  ll = GF_LOG_WARNING;
2600  break;
2601 
2602  case NFS3ERR_DQUOT:
2603  ll = GF_LOG_WARNING;
2604  break;
2605 
2606  default:
2607  ll = GF_LOG_DEBUG;
2608  break;
2609  }
2610 
2611  return ll;
2612 }
2613 
2614 int
2616 {
2617  int ll = GF_LOG_DEBUG;
2618 
2619  switch (stat) {
2620  case NFS3ERR_NOENT:
2621  ll = GF_LOG_WARNING;
2622  break;
2623 
2624  case NFS3ERR_XDEV:
2625  ll = GF_LOG_WARNING;
2626  break;
2627 
2628  case NFS3ERR_NODEV:
2629  ll = GF_LOG_WARNING;
2630  break;
2631 
2632  case NFS3ERR_IO:
2633  ll = GF_LOG_WARNING;
2634  break;
2635 
2636  case NFS3ERR_NXIO:
2637  ll = GF_LOG_WARNING;
2638  break;
2639 
2640  case NFS3ERR_NOTDIR:
2641  ll = GF_LOG_WARNING;
2642  break;
2643 
2644  case NFS3ERR_ISDIR:
2645  ll = GF_LOG_WARNING;
2646  break;
2647 
2648  case NFS3ERR_INVAL:
2649  ll = GF_LOG_WARNING;
2650  break;
2651 
2652  case NFS3ERR_FBIG:
2653  ll = GF_LOG_WARNING;
2654  break;
2655 
2656  case NFS3ERR_MLINK:
2657  ll = GF_LOG_WARNING;
2658  break;
2659 
2660  case NFS3ERR_NOTEMPTY:
2661  ll = GF_LOG_WARNING;
2662  break;
2663 
2664  case NFS3ERR_SERVERFAULT:
2665  ll = GF_LOG_WARNING;
2666  break;
2667 
2668  case NFS3ERR_NOTSUPP:
2669  ll = GF_LOG_WARNING;
2670  break;
2671 
2672  case NFS3ERR_BADHANDLE:
2673  ll = GF_LOG_WARNING;
2674  break;
2675 
2676  case NFS3ERR_STALE:
2677  ll = GF_LOG_WARNING;
2678  break;
2679 
2680  default:
2681  ll = GF_LOG_DEBUG;
2682  break;
2683  }
2684 
2685  return ll;
2686 }
2687 
2688 int
2690 {
2691  int ll = GF_LOG_DEBUG;
2692 
2693  switch (stat) {
2694  case NFS3ERR_EXIST:
2695  ll = GF_LOG_WARNING;
2696  break;
2697 
2698  case NFS3ERR_XDEV:
2699  ll = GF_LOG_WARNING;
2700  break;
2701 
2702  case NFS3ERR_NODEV:
2703  ll = GF_LOG_WARNING;
2704  break;
2705 
2706  case NFS3ERR_IO:
2707  ll = GF_LOG_WARNING;
2708  break;
2709 
2710  case NFS3ERR_NXIO:
2711  ll = GF_LOG_WARNING;
2712  break;
2713 
2714  case NFS3ERR_NOTDIR:
2715  ll = GF_LOG_WARNING;
2716  break;
2717 
2718  case NFS3ERR_INVAL:
2719  ll = GF_LOG_WARNING;
2720  break;
2721 
2722  case NFS3ERR_NOSPC:
2723  ll = GF_LOG_WARNING;
2724  break;
2725 
2726  case NFS3ERR_FBIG:
2727  ll = GF_LOG_WARNING;
2728  break;
2729 
2730  case NFS3ERR_MLINK:
2731  ll = GF_LOG_WARNING;
2732  break;
2733 
2734  case NFS3ERR_SERVERFAULT:
2735  ll = GF_LOG_WARNING;
2736  break;
2737 
2738  case NFS3ERR_NOTSUPP:
2739  ll = GF_LOG_WARNING;
2740  break;
2741 
2742  case NFS3ERR_BADHANDLE:
2743  ll = GF_LOG_WARNING;
2744  break;
2745 
2746  case NFS3ERR_STALE:
2747  ll = GF_LOG_WARNING;
2748  break;
2749 
2750  case NFS3ERR_DQUOT:
2751  ll = GF_LOG_WARNING;
2752  break;
2753 
2754  default:
2755  ll = GF_LOG_DEBUG;
2756  break;
2757  }
2758 
2759  return ll;
2760 }
2761 
2762 int
2764 {
2765  int ll = GF_LOG_DEBUG;
2766 
2767  switch (stat) {
2768  case NFS3ERR_EXIST:
2769  ll = GF_LOG_WARNING;
2770  break;
2771 
2772  case NFS3ERR_XDEV:
2773  ll = GF_LOG_WARNING;
2774  break;
2775 
2776  case NFS3ERR_NODEV:
2777  ll = GF_LOG_WARNING;
2778  break;
2779 
2780  case NFS3ERR_IO:
2781  ll = GF_LOG_WARNING;
2782  break;
2783 
2784  case NFS3ERR_NXIO:
2785  ll = GF_LOG_WARNING;
2786  break;
2787 
2788  case NFS3ERR_NOTDIR:
2789  ll = GF_LOG_WARNING;
2790  break;
2791 
2792  case NFS3ERR_INVAL:
2793  ll = GF_LOG_WARNING;
2794  break;
2795 
2796  case NFS3ERR_NOSPC:
2797  ll = GF_LOG_WARNING;
2798  break;
2799 
2800  case NFS3ERR_FBIG:
2801  ll = GF_LOG_WARNING;
2802  break;
2803 
2804  case NFS3ERR_MLINK:
2805  ll = GF_LOG_WARNING;
2806  break;
2807 
2808  case NFS3ERR_SERVERFAULT:
2809  ll = GF_LOG_WARNING;
2810  break;
2811 
2812  case NFS3ERR_NOTSUPP:
2813  ll = GF_LOG_WARNING;
2814  break;
2815 
2816  case NFS3ERR_BADHANDLE:
2817  ll = GF_LOG_WARNING;
2818  break;
2819 
2820  case NFS3ERR_STALE:
2821  ll = GF_LOG_WARNING;
2822  break;
2823 
2824  case NFS3ERR_DQUOT:
2825  ll = GF_LOG_WARNING;
2826  break;
2827 
2828  default:
2829  ll = GF_LOG_DEBUG;
2830  break;
2831  }
2832 
2833  return ll;
2834 }
2835 
2836 int
2838 {
2839  int ll = GF_LOG_DEBUG;
2840 
2841  switch (stat) {
2842  case NFS3ERR_XDEV:
2843  ll = GF_LOG_WARNING;
2844  break;
2845 
2846  case NFS3ERR_NODEV:
2847  ll = GF_LOG_WARNING;
2848  break;
2849 
2850  case NFS3ERR_IO:
2851  ll = GF_LOG_WARNING;
2852  break;
2853 
2854  case NFS3ERR_NXIO:
2855  ll = GF_LOG_WARNING;
2856  break;
2857 
2858  case NFS3ERR_NOTDIR:
2859  ll = GF_LOG_WARNING;
2860  break;
2861 
2862  case NFS3ERR_ISDIR:
2863  ll = GF_LOG_WARNING;
2864  break;
2865 
2866  case NFS3ERR_INVAL:
2867  ll = GF_LOG_WARNING;
2868  break;
2869 
2870  case NFS3ERR_NOSPC:
2871  ll = GF_LOG_WARNING;
2872  break;
2873 
2874  case NFS3ERR_FBIG:
2875  ll = GF_LOG_WARNING;
2876  break;
2877 
2878  case NFS3ERR_MLINK:
2879  ll = GF_LOG_WARNING;
2880  break;
2881 
2882  case NFS3ERR_NOTEMPTY:
2883  ll = GF_LOG_WARNING;
2884  break;
2885 
2886  case NFS3ERR_SERVERFAULT:
2887  ll = GF_LOG_WARNING;
2888  break;
2889 
2890  case NFS3ERR_NOTSUPP:
2891  ll = GF_LOG_WARNING;
2892  break;
2893 
2894  case NFS3ERR_BADHANDLE:
2895  ll = GF_LOG_WARNING;
2896  break;
2897 
2898  case NFS3ERR_STALE:
2899  ll = GF_LOG_WARNING;
2900  break;
2901 
2902  case NFS3ERR_DQUOT:
2903  ll = GF_LOG_WARNING;
2904  break;
2905 
2906  default:
2907  ll = GF_LOG_DEBUG;
2908  break;
2909  }
2910 
2911  return ll;
2912 }
2913 
2914 int
2916 {
2917  int ll = GF_LOG_DEBUG;
2918 
2919  switch (stat) {
2920  case NFS3ERR_XDEV:
2921  ll = GF_LOG_WARNING;
2922  break;
2923 
2924  case NFS3ERR_NODEV:
2925  ll = GF_LOG_WARNING;
2926  break;
2927 
2928  case NFS3ERR_IO:
2929  ll = GF_LOG_WARNING;
2930  break;
2931 
2932  case NFS3ERR_NXIO:
2933  ll = GF_LOG_WARNING;
2934  break;
2935 
2936  case NFS3ERR_INVAL:
2937  ll = GF_LOG_WARNING;
2938  break;
2939 
2940  case NFS3ERR_FBIG:
2941  ll = GF_LOG_WARNING;
2942  break;
2943 
2944  case NFS3ERR_MLINK:
2945  ll = GF_LOG_WARNING;
2946  break;
2947 
2948  case NFS3ERR_NOTEMPTY:
2949  ll = GF_LOG_WARNING;
2950  break;
2951 
2952  case NFS3ERR_SERVERFAULT:
2953  ll = GF_LOG_WARNING;
2954  break;
2955 
2956  case NFS3ERR_NOTSUPP:
2957  ll = GF_LOG_WARNING;
2958  break;
2959 
2960  case NFS3ERR_BADHANDLE:
2961  ll = GF_LOG_WARNING;
2962  break;
2963 
2964  case NFS3ERR_STALE:
2965  ll = GF_LOG_WARNING;
2966  break;
2967 
2968  case NFS3ERR_DQUOT:
2969  ll = GF_LOG_WARNING;
2970  break;
2971 
2972  default:
2973  ll = GF_LOG_DEBUG;
2974  break;
2975  }
2976 
2977  return ll;
2978 }
2979 
2980 int
2982 {
2983  int ll = GF_LOG_DEBUG;
2984 
2985  switch (stat) {
2986  case NFS3ERR_NOENT:
2987  ll = GF_LOG_WARNING;
2988  break;
2989 
2990  case NFS3ERR_EXIST:
2991  ll = GF_LOG_WARNING;
2992  break;
2993 
2994  case NFS3ERR_XDEV:
2995  ll = GF_LOG_WARNING;
2996  break;
2997 
2998  case NFS3ERR_NODEV:
2999  ll = GF_LOG_WARNING;
3000  break;
3001 
3002  case NFS3ERR_IO:
3003  ll = GF_LOG_WARNING;
3004  break;
3005 
3006  case NFS3ERR_NXIO:
3007  ll = GF_LOG_WARNING;
3008  break;
3009 
3010  case NFS3ERR_NOTDIR:
3011  ll = GF_LOG_WARNING;
3012  break;
3013 
3014  case NFS3ERR_ISDIR:
3015  ll = GF_LOG_WARNING;
3016  break;
3017 
3018  case NFS3ERR_INVAL:
3019  ll = GF_LOG_WARNING;
3020  break;
3021 
3022  case NFS3ERR_NOSPC:
3023  ll = GF_LOG_WARNING;
3024  break;
3025 
3026  case NFS3ERR_ROFS:
3027  ll = GF_LOG_WARNING;
3028  break;
3029 
3030  case NFS3ERR_FBIG:
3031  ll = GF_LOG_WARNING;
3032  break;
3033 
3034  case NFS3ERR_MLINK:
3035  ll = GF_LOG_WARNING;
3036  break;
3037 
3038  case NFS3ERR_NAMETOOLONG:
3039  ll = GF_LOG_WARNING;
3040  break;
3041 
3042  case NFS3ERR_NOTEMPTY:
3043  ll = GF_LOG_WARNING;
3044  break;
3045 
3046  case NFS3ERR_SERVERFAULT:
3047  ll = GF_LOG_WARNING;
3048  break;
3049 
3050  case NFS3ERR_NOTSUPP:
3051  ll = GF_LOG_WARNING;
3052  break;
3053 
3054  case NFS3ERR_BADHANDLE:
3055  ll = GF_LOG_WARNING;
3056  break;
3057 
3058  case NFS3ERR_STALE:
3059  ll = GF_LOG_WARNING;
3060  break;
3061 
3062  case NFS3ERR_DQUOT:
3063  ll = GF_LOG_WARNING;
3064  break;
3065 
3066  default:
3067  ll = GF_LOG_DEBUG;
3068  break;
3069  }
3070 
3071  return ll;
3072 }
3073 
3074 int
3076 {
3077  int ll = GF_LOG_DEBUG;
3078 
3079  switch (stat) {
3080  case NFS3ERR_PERM:
3081  ll = GF_LOG_WARNING;
3082  break;
3083 
3084  case NFS3ERR_NOENT:
3085  ll = GF_LOG_WARNING;
3086  break;
3087 
3088  case NFS3ERR_ACCES:
3089  ll = GF_LOG_WARNING;
3090  break;
3091 
3092  case NFS3ERR_EXIST:
3093  ll = GF_LOG_WARNING;
3094  break;
3095 
3096  case NFS3ERR_XDEV:
3097  ll = GF_LOG_WARNING;
3098  break;
3099 
3100  case NFS3ERR_NODEV:
3101  ll = GF_LOG_WARNING;
3102  break;
3103 
3104  case NFS3ERR_IO:
3105  ll = GF_LOG_WARNING;
3106  break;
3107 
3108  case NFS3ERR_NXIO:
3109  ll = GF_LOG_WARNING;
3110  break;
3111 
3112  case NFS3ERR_NOTDIR:
3113  ll = GF_LOG_WARNING;
3114  break;
3115 
3116  case NFS3ERR_ISDIR:
3117  ll = GF_LOG_WARNING;
3118  break;
3119 
3120  case NFS3ERR_INVAL:
3121  ll = GF_LOG_WARNING;
3122  break;
3123 
3124  case NFS3ERR_NOSPC:
3125  ll = GF_LOG_WARNING;
3126  break;
3127 
3128  case NFS3ERR_ROFS:
3129  ll = GF_LOG_WARNING;
3130  break;
3131 
3132  case NFS3ERR_FBIG:
3133  ll = GF_LOG_WARNING;
3134  break;
3135 
3136  case NFS3ERR_MLINK:
3137  ll = GF_LOG_WARNING;
3138  break;
3139 
3140  case NFS3ERR_NAMETOOLONG:
3141  ll = GF_LOG_WARNING;
3142  break;
3143 
3144  case NFS3ERR_NOTEMPTY:
3145  ll = GF_LOG_WARNING;
3146  break;
3147 
3148  case NFS3ERR_SERVERFAULT:
3149  ll = GF_LOG_WARNING;
3150  break;
3151 
3152  case NFS3ERR_NOTSUPP:
3153  ll = GF_LOG_WARNING;
3154  break;
3155 
3156  case NFS3ERR_BADHANDLE:
3157  ll = GF_LOG_WARNING;
3158  break;
3159 
3160  case NFS3ERR_STALE:
3161  ll = GF_LOG_WARNING;
3162  break;
3163 
3164  case NFS3ERR_DQUOT:
3165  ll = GF_LOG_WARNING;
3166  break;
3167 
3168  default:
3169  ll = GF_LOG_DEBUG;
3170  break;
3171  }
3172 
3173  return ll;
3174 }
3175 
3176 struct nfs3op_str {
3177  int op;
3178  char str[100];
3179 };
3180 
3181 struct nfs3op_str nfs3op_strings[] = {
3182  {NFS3_NULL, "NULL"}, {NFS3_GETATTR, "GETATTR"},
3183  {NFS3_SETATTR, "SETATTR"}, {NFS3_LOOKUP, "LOOKUP"},
3184  {NFS3_ACCESS, "ACCESS"}, {NFS3_READLINK, "READLINK"},
3185  {NFS3_READ, "READ"}, {NFS3_WRITE, "WRITE"},
3186  {NFS3_CREATE, "CREATE"}, {NFS3_MKDIR, "MKDIR"},
3187  {NFS3_SYMLINK, "SYMLINK"}, {NFS3_MKNOD, "MKNOD"},
3188  {NFS3_REMOVE, "REMOVE"}, {NFS3_RMDIR, "RMDIR"},
3189  {NFS3_RENAME, "RENAME"}, {NFS3_LINK, "LINK"},
3190  {NFS3_READDIR, "READDIR"}, {NFS3_READDIRP, "READDIRP"},
3191  {NFS3_FSSTAT, "FSSTAT"}, {NFS3_FSINFO, "FSINFO"},
3192  {NFS3_PATHCONF, "PATHCONF"}, {NFS3_COMMIT, "COMMIT"},
3193 };
3194 
3195 int
3196 nfs3_loglevel(int nfs_op, nfsstat3 stat)
3197 {
3198  int ll = GF_LOG_DEBUG;
3199 
3200  switch (nfs_op) {
3201  case NFS3_GETATTR:
3202  ll = nfs3_getattr_loglevel(stat);
3203  break;
3204 
3205  case NFS3_SETATTR:
3206  ll = nfs3_setattr_loglevel(stat);
3207  break;
3208 
3209  case NFS3_LOOKUP:
3210  ll = nfs3_lookup_loglevel(stat);
3211  break;
3212 
3213  case NFS3_ACCESS:
3214  ll = nfs3_access_loglevel(stat);
3215  break;
3216 
3217  case NFS3_READLINK:
3218  ll = nfs3_readlink_loglevel(stat);
3219  break;
3220 
3221  case NFS3_READ:
3222  ll = nfs3_read_loglevel(stat);
3223  break;
3224 
3225  case NFS3_WRITE:
3226  ll = nfs3_write_loglevel(stat);
3227  break;
3228 
3229  case NFS3_CREATE:
3230  ll = nfs3_create_loglevel(stat);
3231  break;
3232 
3233  case NFS3_MKDIR:
3234  ll = nfs3_mkdir_loglevel(stat);
3235  break;
3236 
3237  case NFS3_SYMLINK:
3238  ll = nfs3_symlink_loglevel(stat);
3239  break;
3240 
3241  case NFS3_MKNOD:
3242  ll = nfs3_mknod_loglevel(stat);
3243  break;
3244 
3245  case NFS3_REMOVE:
3246  ll = nfs3_remove_loglevel(stat);
3247  break;
3248 
3249  case NFS3_RMDIR:
3250  ll = nfs3_rmdir_loglevel(stat);
3251  break;
3252 
3253  case NFS3_RENAME:
3254  ll = nfs3_rename_loglevel(stat);
3255  break;
3256 
3257  case NFS3_LINK:
3258  ll = nfs3_link_loglevel(stat);
3259  break;
3260 
3261  case NFS3_READDIR:
3262  ll = nfs3_readdir_loglevel(stat);
3263  break;
3264 
3265  case NFS3_READDIRP:
3266  ll = nfs3_readdir_loglevel(stat);
3267  break;
3268 
3269  case NFS3_FSSTAT:
3270  ll = nfs3_fsstat_loglevel(stat);
3271  break;
3272 
3273  case NFS3_FSINFO:
3274  ll = nfs3_fsstat_loglevel(stat);
3275  break;
3276 
3277  case NFS3_PATHCONF:
3278  ll = nfs3_fsstat_loglevel(stat);
3279  break;
3280 
3281  case NFS3_COMMIT:
3282  ll = nfs3_write_loglevel(stat);
3283  break;
3284 
3285  default:
3286  ll = GF_LOG_DEBUG;
3287  break;
3288  }
3289 
3290  return ll;
3291 }
3292 
3293 void
3294 nfs3_log_common_res(uint32_t xid, int op, nfsstat3 stat, int pstat,
3295  const char *path)
3296 {
3297  char errstr[1024];
3298  int ll = nfs3_loglevel(op, stat);
3299 
3300  if (THIS->ctx->log.loglevel < ll)
3301  return;
3302  nfs3_stat_to_errstr(xid, nfs3op_strings[op].str, stat, pstat, errstr,
3303  sizeof(errstr));
3304  if (ll == GF_LOG_DEBUG)
3305  gf_msg_debug(GF_NFS3, 0, "%s => (%s)", path, errstr);
3306  else
3307  gf_msg(GF_NFS3, ll, errno, NFS_MSG_STAT_ERROR, "%s => (%s)", path,
3308  errstr);
3309 }
3310 
3311 void
3312 nfs3_log_readlink_res(uint32_t xid, nfsstat3 stat, int pstat, char *linkpath,
3313  const char *path)
3314 {
3315  char errstr[1024];
3316  int ll = nfs3_loglevel(NFS3_READLINK, stat);
3317 
3318  if (THIS->ctx->log.loglevel < ll)
3319  return;
3320 
3321  nfs3_stat_to_errstr(xid, "READLINK", stat, pstat, errstr, sizeof(errstr));
3322  if (ll == GF_LOG_DEBUG)
3323  gf_msg_debug(GF_NFS3, 0, "%s => (%s), target: %s", path, errstr,
3324  linkpath);
3325  else
3326  gf_msg(GF_NFS3, ll, errno, NFS_MSG_STAT_ERROR, "%s => (%s) target: %s",
3327  path, errstr, linkpath);
3328 }
3329 
3330 void
3331 nfs3_log_read_res(uint32_t xid, nfsstat3 stat, int pstat, count3 count,
3332  int is_eof, struct iovec *vec, int32_t veccount,
3333  const char *path)
3334 {
3335  char errstr[1024];
3336  int ll = GF_LOG_DEBUG;
3337 
3338  ll = nfs3_loglevel(NFS3_READ, stat);
3339  if (THIS->ctx->log.loglevel < ll)
3340  return;
3341  nfs3_stat_to_errstr(xid, "READ", stat, pstat, errstr, sizeof(errstr));
3342  if (vec)
3343  if (ll == GF_LOG_DEBUG)
3344  gf_msg_debug(GF_NFS3, 0,
3345  "%s => (%s), count: %" PRIu32
3346  ", is_eof:"
3347  " %d, vector: count: %d, len: %zd",
3348  path, errstr, count, is_eof, veccount, vec->iov_len);
3349  else
3350  gf_msg(GF_NFS3, ll, errno, NFS_MSG_STAT_ERROR,
3351  "%s => (%s), count: %" PRIu32
3352  ", is_eof:"
3353  " %d, vector: count: %d, len: %zd",
3354  path, errstr, count, is_eof, veccount, vec->iov_len);
3355  else if (ll == GF_LOG_DEBUG)
3356  gf_msg_debug(GF_NFS3, 0,
3357  "%s => (%s), count: %" PRIu32
3358  ", is_eof:"
3359  " %d",
3360  path, errstr, count, is_eof);
3361  else
3362  gf_msg(GF_NFS3, ll, errno, NFS_MSG_STAT_ERROR,
3363  "%s => (%s), count: %" PRIu32
3364  ", is_eof:"
3365  " %d",
3366  path, errstr, count, is_eof);
3367 }
3368 
3369 void
3370 nfs3_log_write_res(uint32_t xid, nfsstat3 stat, int pstat, count3 count,
3371  int stable, uint64_t wverf, const char *path)
3372 {
3373  char errstr[1024];
3374  int ll = nfs3_loglevel(NFS3_WRITE, stat);
3375 
3376  if (THIS->ctx->log.loglevel < ll)
3377  return;
3378 
3379  nfs3_stat_to_errstr(xid, "WRITE", stat, pstat, errstr, sizeof(errstr));
3380  if (ll == GF_LOG_DEBUG)
3381  gf_msg_debug(GF_NFS3, 0,
3382  "%s => (%s), count: %" PRIu32
3383  ", %s,wverf: "
3384  "%" PRIu64,
3385  path, errstr, count,
3386  (stable == UNSTABLE) ? "UNSTABLE" : "STABLE", wverf);
3387  else
3388  gf_msg(GF_NFS3, ll, errno, NFS_MSG_STAT_ERROR,
3389  "%s => (%s), count: %" PRIu32 ", %s,wverf: %" PRIu64, path,
3390  errstr, count, (stable == UNSTABLE) ? "UNSTABLE" : "STABLE",
3391  wverf);
3392 }
3393 
3394 void
3395 nfs3_log_newfh_res(uint32_t xid, int op, nfsstat3 stat, int pstat,
3396  struct nfs3_fh *newfh, const char *path)
3397 {
3398  char errstr[1024];
3399  char fhstr[1024];
3400  int ll = nfs3_loglevel(op, stat);
3401 
3402  if (THIS->ctx->log.loglevel < ll)
3403  return;
3404  nfs3_stat_to_errstr(xid, nfs3op_strings[op].str, stat, pstat, errstr,
3405  sizeof(errstr));
3406  nfs3_fh_to_str(newfh, fhstr, sizeof(fhstr));
3407 
3408  if (ll == GF_LOG_DEBUG)
3409  gf_msg_debug(GF_NFS3, 0, "%s => (%s), %s", path, errstr, fhstr);
3410  else
3412  "%s => (%s), %s", path, errstr, fhstr);
3413 }
3414 
3415 void
3416 nfs3_log_readdir_res(uint32_t xid, nfsstat3 stat, int pstat, uint64_t cverf,
3417  count3 count, int is_eof, const char *path)
3418 {
3419  char errstr[1024];
3420  int ll = nfs3_loglevel(NFS3_READDIR, stat);
3421 
3422  if (THIS->ctx->log.loglevel < ll)
3423  return;
3424  nfs3_stat_to_errstr(xid, "READDIR", stat, pstat, errstr, sizeof(errstr));
3425  if (ll == GF_LOG_DEBUG)
3426  gf_msg_debug(GF_NFS3, 0,
3427  "%s => (%s), count: %" PRIu32 ", cverf: %" PRIu64
3428  ", is_eof: %d",
3429  path, errstr, count, cverf, is_eof);
3430  else
3431  gf_msg(GF_NFS3, ll, errno, NFS_MSG_STAT_ERROR,
3432  "%s => (%s), count: %" PRIu32 ", cverf: %" PRIu64 ", is_eof: %d",
3433  path, errstr, count, cverf, is_eof);
3434 }
3435 
3436 void
3437 nfs3_log_readdirp_res(uint32_t xid, nfsstat3 stat, int pstat, uint64_t cverf,
3438  count3 dircount, count3 maxcount, int is_eof,
3439  const char *path)
3440 {
3441  char errstr[1024];
3442  int ll = nfs3_loglevel(NFS3_READDIRP, stat);
3443 
3444  if (THIS->ctx->log.loglevel < ll)
3445  return;
3446  nfs3_stat_to_errstr(xid, "READDIRPLUS", stat, pstat, errstr,
3447  sizeof(errstr));
3448  if (ll == GF_LOG_DEBUG)
3449  gf_msg_debug(GF_NFS3, 0,
3450  "%s => (%s), dircount: %" PRIu32 ", maxcount: %" PRIu32
3451  ", cverf: %" PRIu64 ", is_eof: %d",
3452  path, errstr, dircount, maxcount, cverf, is_eof);
3453  else
3454  gf_msg(GF_NFS3, ll, errno, NFS_MSG_STAT_ERROR,
3455  "%s => (%s), dircount: %" PRIu32 ", maxcount: %" PRIu32
3456  ", cverf: %" PRIu64 ", is_eof: %d",
3457  path, errstr, dircount, maxcount, cverf, is_eof);
3458 }
3459 
3460 void
3461 nfs3_log_commit_res(uint32_t xid, nfsstat3 stat, int pstat, uint64_t wverf,
3462  const char *path)
3463 {
3464  char errstr[1024];
3465  int ll = nfs3_loglevel(NFS3_COMMIT, stat);
3466 
3467  if (THIS->ctx->log.loglevel < ll)
3468  return;
3469  nfs3_stat_to_errstr(xid, "COMMIT", stat, pstat, errstr, sizeof(errstr));
3470  if (ll == GF_LOG_DEBUG)
3471  gf_msg_debug(GF_NFS3, 0, "%s => (%s), wverf: %" PRIu64, path, errstr,
3472  wverf);
3473  else
3474  gf_msg(GF_NFS3, ll, errno, NFS_MSG_STAT_ERROR,
3475  "%s => (%s), wverf: %" PRIu64, path, errstr, wverf);
3476 }
3477 
3478 void
3479 nfs3_log_readdir_call(uint32_t xid, struct nfs3_fh *fh, count3 dircount,
3480  count3 maxcount)
3481 {
3482  char fhstr[1024];
3483 
3484  if (THIS->ctx->log.loglevel < GF_LOG_DEBUG)
3485  return;
3486 
3487  nfs3_fh_to_str(fh, fhstr, sizeof(fhstr));
3488 
3489  if (maxcount == 0)
3490  gf_msg_debug(GF_NFS3, 0,
3491  "XID: %x, READDIR: args: %s,"
3492  " count: %d",
3493  xid, fhstr, (uint32_t)dircount);
3494  else
3495  gf_msg_debug(GF_NFS3, 0,
3496  "XID: %x, READDIRPLUS: args: %s,"
3497  " dircount: %d, maxcount: %d",
3498  xid, fhstr, (uint32_t)dircount, (uint32_t)maxcount);
3499 }
3500 
3501 int
3503 {
3504  int ret = -EFAULT;
3505 
3506  if ((!cs) || (!inode))
3507  return ret;
3508 
3509  gf_msg_trace(GF_NFS3, 0, "FH inode resolved");
3510  ret = nfs_inode_loc_fill(inode, &cs->resolvedloc, NFS_RESOLVE_EXIST);
3511  if (ret < 0) {
3513  "inode loc fill failed");
3514  goto err;
3515  }
3516 
3517  nfs3_call_resume(cs);
3518 
3519 err:
3520  return ret;
3521 }
3522 
3523 int32_t
3525  xlator_t *this, int32_t op_ret,
3526  int32_t op_errno, inode_t *inode,
3527  struct iatt *buf, dict_t *xattr,
3528  struct iatt *postparent)
3529 {
3530  nfs3_call_state_t *cs = NULL;
3531  inode_t *linked_inode = NULL;
3532 
3533  cs = frame->local;
3534  cs->resolve_ret = op_ret;
3535  cs->resolve_errno = op_errno;
3536 
3537  if (op_ret == -1) {
3538  if (op_errno == ENOENT) {
3539  gf_msg_trace(GF_NFS3, 0, "Lookup failed: %s: %s",
3540  cs->resolvedloc.path, strerror(op_errno));
3541  } else {
3543  "Lookup failed: %s: %s", cs->resolvedloc.path,
3544  strerror(op_errno));
3545  }
3546  goto err;
3547  } else
3548  gf_msg_trace(GF_NFS3, 0, "Entry looked up: %s", cs->resolvedloc.path);
3549 
3550  memcpy(&cs->stbuf, buf, sizeof(*buf));
3551  memcpy(&cs->postparent, postparent, sizeof(*postparent));
3552  linked_inode = inode_link(inode, cs->resolvedloc.parent,
3553  cs->resolvedloc.name, buf);
3554  if (linked_inode) {
3555  nfs_fix_generation(this, linked_inode);
3556  inode_lookup(linked_inode);
3558  cs->resolvedloc.inode = linked_inode;
3559  } else {
3560  /* nfs3_fh_resolve_entry_hard() use to resolve entire path if needed.
3561  * So the ctx for inode obtained from here need to set properly,
3562  * otherwise it may result in a crash.
3563  */
3564  nfs_fix_generation(this, inode);
3565  }
3566 err:
3567  nfs3_call_resume(cs);
3568  return 0;
3569 }
3570 
3571 int32_t
3573  xlator_t *this, int32_t op_ret,
3574  int32_t op_errno, inode_t *inode,
3575  struct iatt *buf, dict_t *xattr,
3576  struct iatt *postparent)
3577 {
3578  nfs3_call_state_t *cs = NULL;
3579  inode_t *linked_inode = NULL;
3580 
3581  cs = frame->local;
3582  cs->resolve_ret = op_ret;
3583  cs->resolve_errno = op_errno;
3584 
3585  if (op_ret == -1) {
3586  if (op_errno == ENOENT) {
3587  gf_msg_trace(GF_NFS3, 0, "Lookup failed: %s: %s",
3588  cs->resolvedloc.path, strerror(op_errno));
3589  } else {
3591  "Lookup failed: %s: %s", cs->resolvedloc.path,
3592  strerror(op_errno));
3593  }
3594  nfs3_call_resume(cs);
3595  goto err;
3596  }
3597 
3598  memcpy(&cs->stbuf, buf, sizeof(*buf));
3599  memcpy(&cs->postparent, buf, sizeof(*postparent));
3600  linked_inode = inode_link(inode, cs->resolvedloc.parent,
3601  cs->resolvedloc.name, buf);
3602  if (linked_inode) {
3603  nfs_fix_generation(this, linked_inode);
3604  inode_lookup(linked_inode);
3606  cs->resolvedloc.inode = linked_inode;
3607  }
3608 
3609  /* If it is an entry lookup and we landed in the callback for hard
3610  * inode resolution, it means the parent inode was not available and
3611  * had to be resolved first. Now that is done, lets head back into
3612  * entry resolution.
3613  */
3614  if (cs->resolventry)
3616  else
3617  nfs3_call_resume(cs);
3618 err:
3619  return 0;
3620 }
3621 
3622 /* Needs no extra argument since it knows that the fh to be resolved is in
3623  * resolvefh and that it needs to start looking from the root.
3624  */
3625 int
3627 {
3628  int ret = -EFAULT;
3629  nfs_user_t nfu = {
3630  0,
3631  };
3632 
3633  if (!cs)
3634  return ret;
3635 
3636  gf_msg_trace(GF_NFS3, 0, "FH hard resolution for: gfid 0x%s",
3637  uuid_utoa(cs->resolvefh.gfid));
3638  cs->hardresolved = 1;
3639  nfs_loc_wipe(&cs->resolvedloc);
3640  ret = nfs_gfid_loc_fill(cs->vol->itable, cs->resolvefh.gfid,
3642  if (ret < 0) {
3644  "Failed to fill loc using gfid: "
3645  "%s",
3646  strerror(-ret));
3647  goto out;
3648  }
3649 
3650  nfs_user_root_create(&nfu);
3651  ret = nfs_lookup(cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
3653 
3654 out:
3655  return ret;
3656 }
3657 
3658 int
3660 {
3661  int ret = -EFAULT;
3662  nfs_user_t nfu = {
3663  0,
3664  };
3665  gf_boolean_t freshlookup = _gf_false;
3666 
3667  if (!cs)
3668  return ret;
3669 
3670  nfs_loc_wipe(&cs->resolvedloc);
3671  nfs_user_root_create(&nfu);
3672  gf_msg_trace(GF_NFS3, 0,
3673  "FH hard resolution: gfid: %s "
3674  ", entry: %s",
3675  uuid_utoa(cs->resolvefh.gfid), cs->resolventry);
3676 
3677  ret = nfs_entry_loc_fill(cs->nfsx, cs->vol->itable, cs->resolvefh.gfid,
3678  cs->resolventry, &cs->resolvedloc,
3679  NFS_RESOLVE_CREATE, &freshlookup);
3680 
3681  if (ret == -2) {
3682  gf_msg_trace(GF_NFS3, 0, "Entry needs lookup: %s",
3683  cs->resolvedloc.path);
3684  /* If the NFS op is lookup, let the resume callback
3685  * handle the sending of the lookup fop. Similarly,
3686  * if the NFS op is create, let the create call
3687  * go ahead in the resume callback so that an EEXIST gets
3688  * handled at posix without an extra fop at this point.
3689  */
3690  if (freshlookup &&
3691  (nfs3_lookup_op(cs) ||
3692  (nfs3_create_op(cs) && !nfs3_create_exclusive_op(cs)))) {
3693  cs->lookuptype = GF_NFS3_FRESH;
3694  cs->resolve_ret = 0;
3695  cs->hardresolved = 0;
3696  nfs3_call_resume(cs);
3697  } else {
3698  cs->hardresolved = 1;
3699  nfs_lookup(cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
3701  }
3702  ret = 0;
3703  } else if (ret == -1) {
3704  gf_msg_trace(GF_NFS3, 0, "Entry needs parent lookup: %s",
3705  cs->resolvedloc.path);
3706  ret = nfs3_fh_resolve_inode_hard(cs);
3707  } else if (ret == 0) {
3708  cs->resolve_ret = 0;
3709  nfs3_call_resume(cs);
3710  }
3711 
3712  return ret;
3713 }
3714 
3715 int
3717 {
3718  inode_t *inode = NULL;
3719  int ret = -EFAULT;
3720  xlator_t *this = NULL;
3721 
3722  if (!cs)
3723  return ret;
3724 
3725  this = cs->nfsx;
3726  gf_msg_trace(GF_NFS3, 0, "FH needs inode resolution");
3728 
3729  inode = inode_find(cs->vol->itable, cs->resolvefh.gfid);
3730  if (!inode || inode_ctx_get(inode, this, NULL))
3731  ret = nfs3_fh_resolve_inode_hard(cs);
3732  else
3733  ret = nfs3_fh_resolve_inode_done(cs, inode);
3734 
3735  if (inode)
3736  inode_unref(inode);
3737 
3738  return ret;
3739 }
3740 
3741 int
3743 {
3744  int ret = -EFAULT;
3745 
3746  if (!cs)
3747  return ret;
3748 
3749  return nfs3_fh_resolve_entry_hard(cs);
3750 }
3751 
3752 int
3754 {
3755  int ret = -EFAULT;
3756 
3757  if (!cs)
3758  return ret;
3759 
3760  if (cs->resolve_ret < 0)
3761  goto err_resume_call;
3762 
3763  if (!cs->resolventry)
3764  ret = nfs3_fh_resolve_inode(cs);
3765  else
3766  ret = nfs3_fh_resolve_entry(cs);
3767 
3768 err_resume_call:
3769  if (ret < 0) {
3770  cs->resolve_ret = -1;
3771  cs->resolve_errno = EFAULT;
3772  nfs3_call_resume(cs);
3773  ret = 0;
3774  }
3775 
3776  return ret;
3777 }
3778 
3779 int32_t
3781  xlator_t *this, int32_t op_ret,
3782  int32_t op_errno, inode_t *inode,
3783  struct iatt *buf, dict_t *xattr,
3784  struct iatt *postparent)
3785 {
3786  nfs3_call_state_t *cs = NULL;
3787 
3788  cs = frame->local;
3789  cs->resolve_ret = op_ret;
3790  cs->resolve_errno = op_errno;
3791 
3792  if (op_ret == -1) {
3794  "Root lookup failed: %s", strerror(op_errno));
3795  goto err;
3796  } else
3797  gf_msg_trace(GF_NFS3, 0, "Root looked up: %s", cs->resolvedloc.path);
3798 
3800 err:
3802  return 0;
3803 }
3804 
3805 int
3807 {
3808  int ret = -EFAULT;
3809  nfs_user_t nfu = {
3810  0,
3811  };
3812 
3813  if (!cs)
3814  return ret;
3815 
3816  if (nfs3_is_root_looked_up(cs->nfs3state, &cs->resolvefh)) {
3817  ret = nfs3_fh_resolve_resume(cs);
3818  goto out;
3819  }
3820 
3821  nfs_user_root_create(&nfu);
3822  gf_msg_trace(GF_NFS3, 0, "Root needs lookup");
3823  ret = nfs_root_loc_fill(cs->vol->itable, &cs->resolvedloc);
3824  if (ret < 0) {
3826  "Failed to lookup root from itable: %s", strerror(-ret));
3827  goto out;
3828  }
3829 
3830  ret = nfs_lookup(cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
3832 
3833 out:
3834  return ret;
3835 }
3836 
3843 int
3845 {
3846  struct sockaddr_storage sastorage = {
3847  0,
3848  };
3849  rpc_transport_t *trans = NULL;
3850  int ret = 0;
3851 
3852  /* Why do we pass in the peer here and then
3853  * store it rather than malloc() and return a char * ? We want to avoid
3854  * heap allocations in the IO path as much as possible for speed
3855  * so we try to keep all allocations on the stack.
3856  */
3857  trans = rpcsvc_request_transport(req);
3858  ret = rpcsvc_transport_peeraddr(trans, peer, RPCSVC_PEER_STRLEN, &sastorage,
3859  sizeof(sastorage));
3860  if (ret != 0) {
3862  "Failed to get peer addr: %s", gai_strerror(ret));
3863  }
3864  return ret;
3865 }
3866 
3867 /*
3868  * nfs3_fh_auth_nfsop () -- Checks if an nfsop is authorized.
3869  *
3870  * @cs: The NFS call state containing all the relevant information
3871  *
3872  * @return: 0 if authorized
3873  * -EACCES for completely unauthorized fop
3874  * -EROFS for unauthorized write operations (rm, mkdir, write)
3875  */
3876 int
3878 {
3879  struct nfs_state *nfs = NULL;
3880  struct mount3_state *ms = NULL;
3881 
3882  nfs = (struct nfs_state *)cs->nfsx->private;
3883  ms = (struct mount3_state *)nfs->mstate;
3884  return mnt3_authenticate_request(ms, cs->req, &cs->resolvefh, NULL, NULL,
3885  NULL, NULL, is_write_op);
3886 }
3887 
3888 int
3890  char *entry, nfs3_resume_fn_t resum_fn)
3891 {
3892  int ret = -EFAULT;
3893 
3894  if ((!cs) || (!fh))
3895  return ret;
3896 
3897  cs->resume_fn = resum_fn;
3898  cs->resolvefh = *fh;
3899  cs->hashidx = 0;
3900 
3901  /* Check if the resolution is:
3902  * a. fh resolution
3903  *
3904  * or
3905  *
3906  * b. (fh, basename) resolution
3907  */
3908  if (entry) { /* b */
3909  cs->resolventry = gf_strdup(entry);
3910  if (!cs->resolventry)
3911  goto err;
3912  }
3913 
3914  ret = nfs3_fh_resolve_root(cs);
3915 err:
3916  return ret;
3917 }
nfs3_local::hashidx
int hashidx
Definition: nfs3.h:245
xlator.h
link3res
Definition: xdr-nfs3.h:714
nfs3_fill_symlink3res
void nfs3_fill_symlink3res(symlink3res *res, nfsstat3 stat, struct nfs3_fh *fh, struct iatt *buf, struct iatt *preparent, struct iatt *postparent, uint64_t deviceid)
Definition: nfs3-helpers.c:1209
nfs3_call_resume
#define nfs3_call_resume(cst)
Definition: nfs3-helpers.c:35
NFS_MSG_GET_PEER_ADDR_FAIL
@ NFS_MSG_GET_PEER_ADDR_FAIL
Definition: nfs-messages.h:100
_gf_false
#define _gf_false
Definition: glusterfs.h:369
read3resok::data_len
u_int data_len
Definition: xdr-nfs3.h:407
remove3resok::dir_wcc
wcc_data dir_wcc
Definition: xdr-nfs3.h:627
dirlistp3::entries
entryp3 * entries
Definition: xdr-nfs3.h:786
GF_SET_ATTR_MODE
#define GF_SET_ATTR_MODE
Definition: xlator.h:28
post_op_attr::attributes_follow
bool_t attributes_follow
Definition: xdr-nfs3.h:153
NFS3ERR_IO
@ NFS3ERR_IO
Definition: xdr-nfs3.h:74
set_mode3::set_mode3_u
union set_mode3::@64 set_mode3_u
set_atime::atime
nfstime3 atime
Definition: xdr-nfs3.h:231
remove3res
Definition: xdr-nfs3.h:636
out
#define out(x...)
Definition: gcrawler.c:35
fsinfo3resok
Definition: xdr-nfs3.h:852
mkdir3res::status
nfsstat3 status
Definition: xdr-nfs3.h:538
nfs3_log_common_res
void nfs3_log_common_res(uint32_t xid, int op, nfsstat3 stat, int pstat, const char *path)
Definition: nfs3-helpers.c:3294
readdir3res::status
nfsstat3 status
Definition: xdr-nfs3.h:758
fsinfo3res::status
nfsstat3 status
Definition: xdr-nfs3.h:873
fsinfo3res::resok
fsinfo3resok resok
Definition: xdr-nfs3.h:875
nfs_user_root_create
int nfs_user_root_create(nfs_user_t *newnfu)
Definition: nfs.c:624
fattr3::gid
gid3 gid
Definition: xdr-nfs3.h:140
nfstime3::seconds
uint32 seconds
Definition: xdr-nfs3.h:130
nfs3_create_op
#define nfs3_create_op(cst)
Definition: nfs3.h:272
pathconf3resok::linkmax
uint32 linkmax
Definition: xdr-nfs3.h:888
readdir3res::readdir3res_u
union readdir3res::@90 readdir3res_u
iatt::ia_ctime_nsec
uint32_t ia_ctime_nsec
Definition: iatt.h:63
nfs3_log_fh_entry_call
void nfs3_log_fh_entry_call(uint32_t xid, char *op, struct nfs3_fh *fh, char *name)
Definition: nfs3-helpers.c:1587
NFS3ERR_REMOTE
@ NFS3ERR_REMOTE
Definition: xdr-nfs3.h:91
set_size3::size
size3 size
Definition: xdr-nfs3.h:223
readdirp3resok::reply
dirlistp3 reply
Definition: xdr-nfs3.h:794
pre_op_attr::attributes_follow
bool_t attributes_follow
Definition: xdr-nfs3.h:168
GF_NFS3_MAXFILESIZE
#define GF_NFS3_MAXFILESIZE
Definition: nfs3.h:65
setattr3res
Definition: xdr-nfs3.h:303
lookup3resok::dir_attributes
post_op_attr dir_attributes
Definition: xdr-nfs3.h:320
nfs3_fh_resolve_and_resume
int nfs3_fh_resolve_and_resume(nfs3_call_state_t *cs, struct nfs3_fh *fh, char *entry, nfs3_resume_fn_t resum_fn)
Definition: nfs3-helpers.c:3889
getattr3res::getattr3res_u
union getattr3res::@70 getattr3res_u
mknod3res::resok
mknod3resok resok
Definition: xdr-nfs3.h:615
nfs_fh3
Definition: xdr-nfs3.h:121
NFS3ERR_XDEV
@ NFS3ERR_XDEV
Definition: xdr-nfs3.h:78
NFS3_WRITE
#define NFS3_WRITE
Definition: xdr-nfs3.h:1017
nfs3_setattr_loglevel
int nfs3_setattr_loglevel(nfsstat3 stat)
Definition: nfs3-helpers.c:1825
_gf_dirent::next
struct _gf_dirent * next
Definition: gf-dirent.h:39
ia_prot_t
Definition: iatt.h:35
IA_PROT_STCKY
#define IA_PROT_STCKY(prot)
Definition: iatt.h:157
nfs3_state::readdirsize
uint64_t readdirsize
Definition: nfs3.h:142
nfs3_stat_to_post_op_attr
post_op_attr nfs3_stat_to_post_op_attr(struct iatt *buf)
Definition: nfs3-helpers.c:352
NFS_MSG_LOOKUP_ROOT_FAIL
@ NFS_MSG_LOOKUP_ROOT_FAIL
Definition: nfs-messages.h:100
ia_prot_t::suid
uint8_t suid
Definition: iatt.h:36
iatt::ia_prot
ia_prot_t ia_prot
Definition: iatt.h:71
nfs3_access_loglevel
int nfs3_access_loglevel(nfsstat3 stat)
Definition: nfs3-helpers.c:2017
nfs_state::mstate
struct mount3_state * mstate
Definition: nfs.h:65
fsinfo3resok::time_delta
nfstime3 time_delta
Definition: xdr-nfs3.h:862
fsstat3resok::invarsec
uint32 invarsec
Definition: xdr-nfs3.h:825
access3res::status
nfsstat3 status
Definition: xdr-nfs3.h:362
nfs3_prep_getattr3args
void nfs3_prep_getattr3args(getattr3args *args, struct nfs3_fh *fh)
Definition: nfs3-helpers.c:502
nfs3_loglevel
int nfs3_loglevel(int nfs_op, nfsstat3 stat)
Definition: nfs3-helpers.c:3196
setattr3resok::obj_wcc
wcc_data obj_wcc
Definition: xdr-nfs3.h:294
NFS3MODE_XGROUP
#define NFS3MODE_XGROUP
Definition: xdr-nfs3.h:65
NFS3_ENTRY3_FIXED_SIZE
#define NFS3_ENTRY3_FIXED_SIZE
Definition: xdr-nfs3.h:22
set_mtime::set_it
time_how set_it
Definition: xdr-nfs3.h:237
nfs3_fh_resolve_inode_lookup_cbk
int32_t nfs3_fh_resolve_inode_lookup_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, struct iatt *buf, dict_t *xattr, struct iatt *postparent)
Definition: nfs3-helpers.c:3572
NFS3ERR_NXIO
@ NFS3ERR_NXIO
Definition: xdr-nfs3.h:75
mkdir3res::resok
mkdir3resok resok
Definition: xdr-nfs3.h:540
iatt.h
link3res::resok
link3resok resok
Definition: xdr-nfs3.h:717
POSIX_WRITE
#define POSIX_WRITE
Definition: nfs3-helpers.c:535
nfs3_fh_resolve_entry
int nfs3_fh_resolve_entry(nfs3_call_state_t *cs)
Definition: nfs3-helpers.c:3742
NFS3ERR_BADHANDLE
@ NFS3ERR_BADHANDLE
Definition: xdr-nfs3.h:92
IA_PROT_XOTH
#define IA_PROT_XOTH(prot)
Definition: iatt.h:153
NFS3_READDIR_RESOK_SIZE
#define NFS3_READDIR_RESOK_SIZE
Definition: xdr-nfs3.h:24
NFS3MODE_WOTHER
#define NFS3MODE_WOTHER
Definition: xdr-nfs3.h:67
NFS3_READ
#define NFS3_READ
Definition: xdr-nfs3.h:1016
mknod3res
Definition: xdr-nfs3.h:612
rename3res::resok
rename3resok resok
Definition: xdr-nfs3.h:690
entry3
Definition: xdr-nfs3.h:731
nfs3_is_dot_entry
int nfs3_is_dot_entry(char *entry)
Definition: nfs3-helpers.c:598
readdir3resok::reply
dirlist3 reply
Definition: xdr-nfs3.h:748
nfs3_extract_nfs3_fh
struct nfs3_fh nfs3_extract_nfs3_fh(nfs_fh3 fh)
Definition: nfs3-helpers.c:117
iatt
Definition: iatt.h:46
NFS3_READDIRP
#define NFS3_READDIRP
Definition: xdr-nfs3.h:1027
nfs3_create_loglevel
int nfs3_create_loglevel(nfsstat3 stat)
Definition: nfs3-helpers.c:2385
nfs3_log_common_call
void nfs3_log_common_call(uint32_t xid, char *op, struct nfs3_fh *fh)
Definition: nfs3-helpers.c:1575
remove3args
Definition: xdr-nfs3.h:621
createmode3
createmode3
Definition: xdr-nfs3.h:476
_gf_dirent::d_name
char d_name[]
Definition: gf-dirent.h:50
iatt::ia_blocks
uint64_t ia_blocks
Definition: iatt.h:56
rmdir3res::status
nfsstat3 status
Definition: xdr-nfs3.h:661
getattr3res
Definition: xdr-nfs3.h:270
NFS3ERR_NOSPC
@ NFS3ERR_NOSPC
Definition: xdr-nfs3.h:84
rename3res::status
nfsstat3 status
Definition: xdr-nfs3.h:688
readdir3resok::dir_attributes
post_op_attr dir_attributes
Definition: xdr-nfs3.h:746
NFS3ERR_INVAL
@ NFS3ERR_INVAL
Definition: xdr-nfs3.h:82
lookup3args
Definition: xdr-nfs3.h:312
nfs3_prep_fsstat3args
void nfs3_prep_fsstat3args(fsstat3args *args, struct nfs3_fh *fh)
Definition: nfs3-helpers.c:942
GF_SET_ATTR_SIZE
#define GF_SET_ATTR_SIZE
Definition: xlator.h:31
commit3resok::file_wcc
wcc_data file_wcc
Definition: xdr-nfs3.h:919
IA_ISCHR
#define IA_ISCHR(t)
Definition: iatt.h:138
THIS
#define THIS
Definition: globals.h:126
NFS3_OK
@ NFS3_OK
Definition: xdr-nfs3.h:71
nfs3_log_readdir_res
void nfs3_log_readdir_res(uint32_t xid, nfsstat3 stat, int pstat, uint64_t cverf, count3 count, int is_eof, const char *path)
Definition: nfs3-helpers.c:3416
NFS3MODE_ROTHER
#define NFS3MODE_ROTHER
Definition: xdr-nfs3.h:66
pathconf3resok::name_max
uint32 name_max
Definition: xdr-nfs3.h:889
NFS3ERR_PERM
@ NFS3ERR_PERM
Definition: xdr-nfs3.h:72
nfs3_set_root_looked_up
int nfs3_set_root_looked_up(struct nfs3_state *nfs3, struct nfs3_fh *rootfh)
Definition: nfs3.c:188
NFS3_LOOKUP
#define NFS3_LOOKUP
Definition: xdr-nfs3.h:1013
nfs3_readdir_loglevel
int nfs3_readdir_loglevel(nfsstat3 stat)
Definition: nfs3-helpers.c:2981
mknod3res::status
nfsstat3 status
Definition: xdr-nfs3.h:613
nfs3_local::lookuptype
nfs3_lookup_type_t lookuptype
Definition: nfs3.h:248
NFS3_SETATTR
#define NFS3_SETATTR
Definition: xdr-nfs3.h:1012
mkdir3resok::obj
post_op_fh3 obj
Definition: xdr-nfs3.h:526
nfs3_prep_fsinfo3args
void nfs3_prep_fsinfo3args(fsinfo3args *args, struct nfs3_fh *root)
Definition: nfs3-helpers.c:509
NFS3MODE_WOWNER
#define NFS3MODE_WOWNER
Definition: xdr-nfs3.h:61
nfs3_local::resume_fn
nfs3_resume_fn_t resume_fn
Definition: nfs3.h:198
fattr3::atime
nfstime3 atime
Definition: xdr-nfs3.h:146
nfs-inodes.h
ACCESS3_DELETE
#define ACCESS3_DELETE
Definition: xdr-nfs3.h:341
nfs3_fh_auth_nfsop
int nfs3_fh_auth_nfsop(nfs3_call_state_t *cs, bool is_write_op)
Definition: nfs3-helpers.c:3877
fattr3::mtime
nfstime3 mtime
Definition: xdr-nfs3.h:147
fsstat3res::fsstat3res_u
union fsstat3res::@92 fsstat3res_u
nfstime3::nseconds
uint32 nseconds
Definition: xdr-nfs3.h:131
ACCESS3_LOOKUP
#define ACCESS3_LOOKUP
Definition: xdr-nfs3.h:338
nfs3_fh_resolve_resume
int nfs3_fh_resolve_resume(nfs3_call_state_t *cs)
Definition: nfs3-helpers.c:3753
stable_how
stable_how
Definition: xdr-nfs3.h:427
nfs3stat_strerror::strerror
char strerror[100]
Definition: nfs3-helpers.c:50
GF_FREE
#define GF_FREE(free_ptr)
Definition: mem-pool.h:159
getattr3resok::obj_attributes
fattr3 obj_attributes
Definition: xdr-nfs3.h:266
args
union args_ args
nfs3_iatt_gfid_to_ino
uint64_t nfs3_iatt_gfid_to_ino(struct iatt *buf)
Definition: nfs3-helpers.c:88
nfs3_log_rw_call
void nfs3_log_rw_call(uint32_t xid, char *op, struct nfs3_fh *fh, offset3 offt, count3 count, int stablewrite)
Definition: nfs3-helpers.c:1701
pre_op_attr::attributes
wcc_attr attributes
Definition: xdr-nfs3.h:170
commit3resok::verf
writeverf3 verf
Definition: xdr-nfs3.h:920
link3resok::file_attributes
post_op_attr file_attributes
Definition: xdr-nfs3.h:703
wcc_data::before
pre_op_attr before
Definition: xdr-nfs3.h:176
IA_PROT_XGRP
#define IA_PROT_XGRP(prot)
Definition: iatt.h:149
NFS3ERR_NOTEMPTY
@ NFS3ERR_NOTEMPTY
Definition: xdr-nfs3.h:88
fsinfo3resok::wtpref
uint32 wtpref
Definition: xdr-nfs3.h:858
pathconf3args
Definition: xdr-nfs3.h:881
read3res::status
nfsstat3 status
Definition: xdr-nfs3.h:419
ia_prot_t::group
struct ia_prot_t::@16 group
readdirp3res::readdirp3res_u
union readdirp3res::@91 readdirp3res_u
nfs3_extract_lookup_fh
struct nfs3_fh nfs3_extract_lookup_fh(lookup3args *args)
Definition: nfs3-helpers.c:126
nfs3_fill_rmdir3res
void nfs3_fill_rmdir3res(rmdir3res *res, nfsstat3 stat, struct iatt *preparent, struct iatt *postparent, uint64_t deviceid)
Definition: nfs3-helpers.c:1321
nfs3_prep_create3args
void nfs3_prep_create3args(create3args *args, struct nfs3_fh *fh, char *name)
Definition: nfs3-helpers.c:1137
nfs3_log_readdirp_res
void nfs3_log_readdirp_res(uint32_t xid, nfsstat3 stat, int pstat, uint64_t cverf, count3 dircount, count3 maxcount, int is_eof, const char *path)
Definition: nfs3-helpers.c:3437
NF3BLK
@ NF3BLK
Definition: xdr-nfs3.h:107
nfs-generics.h
IA_ISFIFO
#define IA_ISFIFO(t)
Definition: iatt.h:139
NFS3ERR_ROFS
@ NFS3ERR_ROFS
Definition: xdr-nfs3.h:85
gf_nfs_mt_char
@ gf_nfs_mt_char
Definition: nfs-mem-types.h:20
_gf_dirent::inode
inode_t * inode
Definition: gf-dirent.h:49
NFS3MODE_SETXGID
#define NFS3MODE_SETXGID
Definition: xdr-nfs3.h:58
nfs3stat_strerror
Definition: nfs3-helpers.c:48
remove3res::status
nfsstat3 status
Definition: xdr-nfs3.h:637
readdir3args
Definition: xdr-nfs3.h:723
nfsstat3
nfsstat3
Definition: xdr-nfs3.h:70
nfs3_log_write_res
void nfs3_log_write_res(uint32_t xid, nfsstat3 stat, int pstat, count3 count, int stable, uint64_t wverf, const char *path)
Definition: nfs3-helpers.c:3370
fattr3::fileid
fileid3 fileid
Definition: xdr-nfs3.h:145
nfs3_fill_remove3res
void nfs3_fill_remove3res(remove3res *res, nfsstat3 stat, struct iatt *preparent, struct iatt *postparent, uint64_t deviceid)
Definition: nfs3-helpers.c:1288
_call_frame
Definition: stack.h:63
readlink3res
Definition: xdr-nfs3.h:386
pathconf3resok::case_preserving
bool_t case_preserving
Definition: xdr-nfs3.h:893
iatt::ia_ctime
int64_t ia_ctime
Definition: iatt.h:59
IA_ISLNK
#define IA_ISLNK(t)
Definition: iatt.h:136
iatt::ia_atime_nsec
uint32_t ia_atime_nsec
Definition: iatt.h:61
NFS_RESOLVE_CREATE
#define NFS_RESOLVE_CREATE
Definition: nfs-common.h:50
read3args
Definition: xdr-nfs3.h:395
cookie3
uint64 cookie3
Definition: xdr-nfs3.h:46
lookup3res
Definition: xdr-nfs3.h:329
rpcsvc_transport_peeraddr
int rpcsvc_transport_peeraddr(rpc_transport_t *trans, char *addrstr, int addrlen, struct sockaddr_storage *sa, socklen_t sasize)
Definition: rpcsvc.c:1936
read3res::read3res_u
union read3res::@77 read3res_u
NFS3MODE_RGROUP
#define NFS3MODE_RGROUP
Definition: xdr-nfs3.h:63
nfs_fh3::data
struct nfs_fh3::@60 data
set_mode3::set_it
bool_t set_it
Definition: xdr-nfs3.h:197
write3resok::committed
stable_how committed
Definition: xdr-nfs3.h:457
nfs3_fill_post_op_fh3
void nfs3_fill_post_op_fh3(struct nfs3_fh *fh, post_op_fh3 *pfh)
Definition: nfs3-helpers.c:681
readdir3res
Definition: xdr-nfs3.h:757
nfs3_funge_root_dotdot_dirent
void nfs3_funge_root_dotdot_dirent(gf_dirent_t *ent, struct nfs3_fh *dfh)
Definition: nfs3-helpers.c:626
nfs3_is_parentdir_entry
int nfs3_is_parentdir_entry(char *entry)
Definition: nfs3-helpers.c:612
fattr3::uid
uid3 uid
Definition: xdr-nfs3.h:139
nfs3_request_to_accessbits
uint32_t nfs3_request_to_accessbits(int32_t accbits)
Definition: nfs3-helpers.c:557
IA_PROT_RUSR
#define IA_PROT_RUSR(prot)
Definition: iatt.h:143
entryp3::nextentry
struct entryp3 * nextentry
Definition: xdr-nfs3.h:781
_inode
Definition: inode.h:99
nfs3_fill_write3res
void nfs3_fill_write3res(write3res *res, nfsstat3 stat, count3 count, stable_how stable, uint64_t wverf, struct iatt *prestat, struct iatt *poststat, uint64_t deviceid)
Definition: nfs3-helpers.c:1414
IA_PROT_WGRP
#define IA_PROT_WGRP(prot)
Definition: iatt.h:148
mnt3_authenticate_request
int mnt3_authenticate_request(struct mount3_state *ms, rpcsvc_request_t *req, struct nfs3_fh *fh, const char *volname, const char *path, char **authorized_path, char **authorized_host, bool is_write_op)
Definition: mount3.c:2114
NFS3_RENAME
#define NFS3_RENAME
Definition: xdr-nfs3.h:1024
nfs_fix_generation
void nfs_fix_generation(xlator_t *this, inode_t *inode)
Definition: nfs-common.c:419
nfs3_log_link_call
void nfs3_log_link_call(uint32_t xid, struct nfs3_fh *fh, char *name, struct nfs3_fh *tgt)
Definition: nfs3-helpers.c:1684
nfs3_free_readdirp3res
void nfs3_free_readdirp3res(readdirp3res *res)
Definition: nfs3-helpers.c:901
nfs3_lookup_op
#define nfs3_lookup_op(cst)
Definition: nfs3.h:271
nfs3_local::resolventry
char * resolventry
Definition: nfs3.h:247
pre_op_attr::pre_op_attr_u
union pre_op_attr::@62 pre_op_attr_u
read3resok::eof
bool_t eof
Definition: xdr-nfs3.h:405
rmdir3args
Definition: xdr-nfs3.h:645
nfs3_prep_pathconf3args
void nfs3_prep_pathconf3args(pathconf3args *args, struct nfs3_fh *fh)
Definition: nfs3-helpers.c:1507
_loc::parent
inode_t * parent
Definition: xlator.h:70
fattr3::mode
mode3 mode
Definition: xdr-nfs3.h:137
fsinfo3resok::rtmult
uint32 rtmult
Definition: xdr-nfs3.h:856
NFS_RESOLVE_EXIST
#define NFS_RESOLVE_EXIST
Definition: nfs-common.h:49
entry3::fileid
fileid3 fileid
Definition: xdr-nfs3.h:732
nfs3-helpers.h
getattr3res::status
nfsstat3 status
Definition: xdr-nfs3.h:271
specdata3::specdata2
uint32 specdata2
Definition: xdr-nfs3.h:117
ia_prot_t::owner
struct ia_prot_t::@16 owner
nfs3.h
nfs_loc_wipe
void nfs_loc_wipe(loc_t *loc)
Definition: nfs-common.c:117
NFS3ERR_NOENT
@ NFS3ERR_NOENT
Definition: xdr-nfs3.h:73
NFS3ERR_ISDIR
@ NFS3ERR_ISDIR
Definition: xdr-nfs3.h:81
nfs_fh3::data_val
char * data_val
Definition: xdr-nfs3.h:124
access3res::access3res_u
union access3res::@74 access3res_u
ACCESS3_EXTEND
#define ACCESS3_EXTEND
Definition: xdr-nfs3.h:340
pathconf3resok::obj_attributes
post_op_attr obj_attributes
Definition: xdr-nfs3.h:887
NFS3_FSINFO
#define NFS3_FSINFO
Definition: xdr-nfs3.h:1029
pathconf3resok::case_insensitive
bool_t case_insensitive
Definition: xdr-nfs3.h:892
set_gid3::set_gid3_u
union set_gid3::@66 set_gid3_u
pathconf3res
Definition: xdr-nfs3.h:902
GF_LOG_WARNING
@ GF_LOG_WARNING
Definition: logging.h:74
nfs3_fh_resolve_inode_hard
int nfs3_fh_resolve_inode_hard(nfs3_call_state_t *cs)
Definition: nfs3-helpers.c:3626
nfs3-fh.h
read3res
Definition: xdr-nfs3.h:418
gf_is_zero_filled_stat
bool gf_is_zero_filled_stat(struct iatt *buf)
Definition: common-utils.c:5047
GF_SET_ATTR_MTIME
#define GF_SET_ATTR_MTIME
Definition: xlator.h:33
NFS3_SYMLINK
#define NFS3_SYMLINK
Definition: xdr-nfs3.h:1020
fattr3
Definition: xdr-nfs3.h:135
rename3args
Definition: xdr-nfs3.h:669
pathconf3res::status
nfsstat3 status
Definition: xdr-nfs3.h:903
readdir3resok::cookieverf
cookieverf3 cookieverf
Definition: xdr-nfs3.h:747
nfs3_log_newfh_res
void nfs3_log_newfh_res(uint32_t xid, int op, nfsstat3 stat, int pstat, struct nfs3_fh *newfh, const char *path)
Definition: nfs3-helpers.c:3395
wcc_attr::size
size3 size
Definition: xdr-nfs3.h:161
GF_NFS3_WTMULT
#define GF_NFS3_WTMULT
Definition: nfs3.h:58
rpc_transport
Definition: rpc-transport.h:162
NFS3_PATHCONF
#define NFS3_PATHCONF
Definition: xdr-nfs3.h:1030
iatt::ia_mtime_nsec
uint32_t ia_mtime_nsec
Definition: iatt.h:62
POSIX_EXEC
#define POSIX_EXEC
Definition: nfs3-helpers.c:536
nfs3_extract_lookup_name
char * nfs3_extract_lookup_name(lookup3args *args)
Definition: nfs3-helpers.c:132
lookup3res::lookup3res_u
union lookup3res::@73 lookup3res_u
nfs_root_loc_fill
int nfs_root_loc_fill(inode_table_t *itable, loc_t *loc)
Definition: nfs-common.c:273
nfs3_mknod_loglevel
int nfs3_mknod_loglevel(nfsstat3 stat)
Definition: nfs3-helpers.c:2615
nfs_gfid_loc_fill
int nfs_gfid_loc_fill(inode_table_t *itable, uuid_t gfid, loc_t *loc, int how)
Definition: nfs-common.c:222
nfs3_stat_to_pre_op_attr
pre_op_attr nfs3_stat_to_pre_op_attr(struct iatt *pre)
Definition: nfs3-helpers.c:376
gf_boolean_t
#define gf_boolean_t
Definition: glusterfs.h:368
iatt::ia_gid
uint32_t ia_gid
Definition: iatt.h:54
size3
uint64 size3
Definition: xdr-nfs3.h:52
GF_NFS3
#define GF_NFS3
Definition: nfs3.h:29
nfs3_fill_create3res
void nfs3_fill_create3res(create3res *res, nfsstat3 stat, struct nfs3_fh *newfh, struct iatt *newbuf, struct iatt *preparent, struct iatt *postparent, uint64_t deviceid)
Definition: nfs3-helpers.c:1109
fsstat3res::resok
fsstat3resok resok
Definition: xdr-nfs3.h:837
remove3res::remove3res_u
union remove3res::@86 remove3res_u
inode_ctx_get
#define inode_ctx_get(i, x, v)
Definition: inode.h:272
write3res::status
nfsstat3 status
Definition: xdr-nfs3.h:468
set_atime::set_atime_u
union set_atime::@68 set_atime_u
GF_LOG_DEBUG
@ GF_LOG_DEBUG
Definition: logging.h:77
nfs_entry_loc_fill
int nfs_entry_loc_fill(xlator_t *this, inode_table_t *itable, uuid_t pargfid, char *entry, loc_t *loc, int how, bool *freshlookup)
Definition: nfs-common.c:310
write3resok::file_wcc
wcc_data file_wcc
Definition: xdr-nfs3.h:455
getattr3res::resok
getattr3resok resok
Definition: xdr-nfs3.h:273
lookup3resok::obj_attributes
post_op_attr obj_attributes
Definition: xdr-nfs3.h:319
nfs3_log_read_res
void nfs3_log_read_res(uint32_t xid, nfsstat3 stat, int pstat, count3 count, int is_eof, struct iovec *vec, int32_t veccount, const char *path)
Definition: nfs3-helpers.c:3331
post_op_fh3::post_op_fh3_u
union post_op_fh3::@63 post_op_fh3_u
GUARDED
@ GUARDED
Definition: xdr-nfs3.h:478
nfs3op_str
Definition: nfs3-helpers.c:3176
pathconf3res::pathconf3res_u
union pathconf3res::@94 pathconf3res_u
readdir3res::resok
readdir3resok resok
Definition: xdr-nfs3.h:760
NFS3_MKDIR
#define NFS3_MKDIR
Definition: xdr-nfs3.h:1019
NFS_MSG_STAT_ERROR
@ NFS_MSG_STAT_ERROR
Definition: nfs-messages.h:100
dirlist3::eof
bool_t eof
Definition: xdr-nfs3.h:741
readlink3resok::symlink_attributes
post_op_attr symlink_attributes
Definition: xdr-nfs3.h:376
nfs3_local::resolve_ret
int resolve_ret
Definition: nfs3.h:243
NFS3ERR_NAMETOOLONG
@ NFS3ERR_NAMETOOLONG
Definition: xdr-nfs3.h:87
nfs3_prep_rename3args
void nfs3_prep_rename3args(rename3args *args, struct nfs3_fh *olddirfh, char *oldname, struct nfs3_fh *newdirfh, char *newname)
Definition: nfs3-helpers.c:1370
nfs3_log_commit_res
void nfs3_log_commit_res(uint32_t xid, nfsstat3 stat, int pstat, uint64_t wverf, const char *path)
Definition: nfs3-helpers.c:3461
wcc_data
Definition: xdr-nfs3.h:175
post_op_fh3::handle
nfs_fh3 handle
Definition: xdr-nfs3.h:184
nfs3op_str::op
int op
Definition: nfs3-helpers.c:3177
NFS3_CREATE
#define NFS3_CREATE
Definition: xdr-nfs3.h:1018
iatt::ia_dev
uint64_t ia_dev
Definition: iatt.h:49
NFS3ERR_JUKEBOX
@ NFS3ERR_JUKEBOX
Definition: xdr-nfs3.h:99
nfs3_prep_readdir3args
void nfs3_prep_readdir3args(readdir3args *ra, struct nfs3_fh *fh)
Definition: nfs3-helpers.c:591
IA_ISDIR
#define IA_ISDIR(t)
Definition: iatt.h:135
nfs3_extract_fsinfo_fh
struct nfs3_fh nfs3_extract_fsinfo_fh(fsinfo3args *args)
Definition: nfs3-helpers.c:458
remove3res::resok
remove3resok resok
Definition: xdr-nfs3.h:639
sattr3::size
set_size3 size
Definition: xdr-nfs3.h:248
gf_msg
#define gf_msg(dom, level, errnum, msgid, fmt...)
Definition: logging.h:229
nfs3_stat_to_wcc_data
wcc_data nfs3_stat_to_wcc_data(struct iatt *pre, struct iatt *post)
Definition: nfs3-helpers.c:1094
_call_frame::local
void * local
Definition: stack.h:67
nfs3_local
Definition: nfs3.h:193
readdirp3res
Definition: xdr-nfs3.h:803
fattr3::ctime
nfstime3 ctime
Definition: xdr-nfs3.h:148
NFS3MODE_SAVESWAPTXT
#define NFS3MODE_SAVESWAPTXT
Definition: xdr-nfs3.h:59
lookup3res::resok
lookup3resok resok
Definition: xdr-nfs3.h:332
set_gid3::gid
gid3 gid
Definition: xdr-nfs3.h:215
mount3_state::nfs
struct nfs_state * nfs
Definition: mount3.h:129
readlink3resok::data
nfspath3 data
Definition: xdr-nfs3.h:377
rbthash.h
nfs3_fill_fsstat3res
void nfs3_fill_fsstat3res(fsstat3res *res, nfsstat3 stat, struct statvfs *fsbuf, struct iatt *postbuf, uint64_t deviceid)
Definition: nfs3-helpers.c:949
create3res::status
nfsstat3 status
Definition: xdr-nfs3.h:511
args_
Definition: nfs3.h:160
GF_NFS3_FRESH
@ GF_NFS3_FRESH
Definition: nfs3.h:157
gf_msg_debug
#define gf_msg_debug(dom, errnum, fmt...)
Definition: logging.h:270
mknod3args
Definition: xdr-nfs3.h:594
nfs3_write_loglevel
int nfs3_write_loglevel(nfsstat3 stat)
Definition: nfs3-helpers.c:2291
fsinfo3resok::wtmax
uint32 wtmax
Definition: xdr-nfs3.h:857
ia_prot_t::sgid
uint8_t sgid
Definition: iatt.h:37
nfs3_mkdir_loglevel
int nfs3_mkdir_loglevel(nfsstat3 stat)
Definition: nfs3-helpers.c:2463
readlink3res::status
nfsstat3 status
Definition: xdr-nfs3.h:387
lookup3resok::object
nfs_fh3 object
Definition: xdr-nfs3.h:318
nfs3_fill_getattr3res
void nfs3_fill_getattr3res(getattr3res *res, nfsstat3 stat, struct iatt *buf, uint64_t deviceid)
Definition: nfs3-helpers.c:445
nfs3_log_mknod_call
void nfs3_log_mknod_call(uint32_t xid, struct nfs3_fh *fh, char *name, int type)
Definition: nfs3-helpers.c:1642
nfs3_stat_to_fattr3
void nfs3_stat_to_fattr3(struct iatt *buf, fattr3 *fa)
Definition: nfs3-helpers.c:274
nfstime3
Definition: xdr-nfs3.h:129
ia_prot_t::read
uint8_t read
Definition: iatt.h:40
iatt::ia_uid
uint32_t ia_uid
Definition: iatt.h:53
NFS3ERR_EXIST
@ NFS3ERR_EXIST
Definition: xdr-nfs3.h:77
inode_unref
inode_t * inode_unref(inode_t *inode)
Definition: inode.c:588
rename3res
Definition: xdr-nfs3.h:687
read3res::resok
read3resok resok
Definition: xdr-nfs3.h:421
fattr3::rdev
specdata3 rdev
Definition: xdr-nfs3.h:143
SET_TO_SERVER_TIME
@ SET_TO_SERVER_TIME
Definition: xdr-nfs3.h:191
readlink3res::resok
readlink3resok resok
Definition: xdr-nfs3.h:389
write3args
Definition: xdr-nfs3.h:434
nfs3_resume_fn_t
int(* nfs3_resume_fn_t)(void *cs)
Definition: nfs3.h:181
IA_PROT_SGID
#define IA_PROT_SGID(prot)
Definition: iatt.h:156
nfs3stat_strerror_table
struct nfs3stat_strerror nfs3stat_strerror_table[]
Definition: nfs3-helpers.c:53
entryp3::name
filename3 name
Definition: xdr-nfs3.h:777
symlink3resok::dir_wcc
wcc_data dir_wcc
Definition: xdr-nfs3.h:561
fsstat3resok::abytes
size3 abytes
Definition: xdr-nfs3.h:821
NFS3ERR_END_OF_LIST
@ NFS3ERR_END_OF_LIST
Definition: xdr-nfs3.h:100
_gf_dirent::d_stat
struct iatt d_stat
Definition: gf-dirent.h:47
mkdir3args
Definition: xdr-nfs3.h:519
nfs3_local::postparent
struct iatt postparent
Definition: nfs3.h:219
sattr3::mode
set_mode3 mode
Definition: xdr-nfs3.h:245
fsinfo3resok::rtpref
uint32 rtpref
Definition: xdr-nfs3.h:855
nfs3_fh_to_str
void nfs3_fh_to_str(struct nfs3_fh *fh, char *str, size_t len)
Definition: nfs3-fh.c:113
nfs3_prep_readdirp3args
void nfs3_prep_readdirp3args(readdirp3args *ra, struct nfs3_fh *fh)
Definition: nfs3-helpers.c:894
post_op_attr::post_op_attr_u
union post_op_attr::@61 post_op_attr_u
nfs3_state
Definition: nfs3.h:116
create3resok::obj
post_op_fh3 obj
Definition: xdr-nfs3.h:499
ia_prot_t::other
struct ia_prot_t::@16 other
symlink3res::symlink3res_u
union symlink3res::@83 symlink3res_u
nfs3_fh_is_root_fh
int nfs3_fh_is_root_fh(struct nfs3_fh *fh)
Definition: nfs3-fh.c:99
readdir3args::dir
nfs_fh3 dir
Definition: xdr-nfs3.h:724
fsstat3res::status
nfsstat3 status
Definition: xdr-nfs3.h:835
nfs3_log_symlink_call
void nfs3_log_symlink_call(uint32_t xid, struct nfs3_fh *fh, char *name, char *tgt)
Definition: nfs3-helpers.c:1670
post_op_fh3
Definition: xdr-nfs3.h:181
set_atime::set_it
time_how set_it
Definition: xdr-nfs3.h:229
nfs3_fill_readdir3res
void nfs3_fill_readdir3res(readdir3res *res, nfsstat3 stat, struct nfs3_fh *dirfh, uint64_t cverf, struct iatt *dirstat, gf_dirent_t *entries, count3 count, int is_eof, uint64_t deviceid)
Definition: nfs3-helpers.c:776
nfs3_prep_commit3args
void nfs3_prep_commit3args(commit3args *args, struct nfs3_fh *fh)
Definition: nfs3-helpers.c:1435
_gf_dirent::d_off
uint64_t d_off
Definition: gf-dirent.h:44
nfs3_read_loglevel
int nfs3_read_loglevel(nfsstat3 stat)
Definition: nfs3-helpers.c:2197
mkdir3resok::obj_attributes
post_op_attr obj_attributes
Definition: xdr-nfs3.h:527
mount3_state
Definition: mount3.h:125
fsstat3resok::obj_attributes
post_op_attr obj_attributes
Definition: xdr-nfs3.h:818
nfs3_verify_dircookie
int nfs3_verify_dircookie(struct nfs3_state *nfs3, fd_t *dirfd, cookie3 cookie, uint64_t cverf, nfsstat3 *stat)
Definition: nfs3-helpers.c:1514
_xlator::private
void * private
Definition: xlator.h:822
rpcsvc_request
Definition: rpcsvc.h:155
nfs3_link_loglevel
int nfs3_link_loglevel(nfsstat3 stat)
Definition: nfs3-helpers.c:2915
fattr3::size
size3 size
Definition: xdr-nfs3.h:141
entryp3::cookie
cookie3 cookie
Definition: xdr-nfs3.h:778
_fd
Definition: fd.h:39
nfs3_fh_resolve_entry_lookup_cbk
int32_t nfs3_fh_resolve_entry_lookup_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, struct iatt *buf, dict_t *xattr, struct iatt *postparent)
Definition: nfs3-helpers.c:3524
specdata3::specdata1
uint32 specdata1
Definition: xdr-nfs3.h:116
iatt::ia_mtime
int64_t ia_mtime
Definition: iatt.h:58
nfs3_fill_commit3res
void nfs3_fill_commit3res(commit3res *res, nfsstat3 stat, uint64_t wverf, struct iatt *prestat, struct iatt *poststat, uint64_t deviceid)
Definition: nfs3-helpers.c:1442
iatt::ia_gfid
uuid_t ia_gfid
Definition: iatt.h:69
NFS3_ACCESS
#define NFS3_ACCESS
Definition: xdr-nfs3.h:1014
nfs3_fh_build_child_fh
int nfs3_fh_build_child_fh(struct nfs3_fh *parent, struct iatt *newstat, struct nfs3_fh *newfh)
Definition: nfs3-fh.c:170
uuid_utoa
char * uuid_utoa(uuid_t uuid)
Definition: common-utils.c:2841
IA_PROT_ROTH
#define IA_PROT_ROTH(prot)
Definition: iatt.h:151
nfs3_fill_mkdir3res
void nfs3_fill_mkdir3res(mkdir3res *res, nfsstat3 stat, struct nfs3_fh *fh, struct iatt *buf, struct iatt *preparent, struct iatt *postparent, uint64_t deviceid)
Definition: nfs3-helpers.c:1176
nfs3_fill_lookup3res_success
void nfs3_fill_lookup3res_success(lookup3res *res, nfsstat3 stat, struct nfs3_fh *fh, struct iatt *buf, struct iatt *postparent)
Definition: nfs3-helpers.c:402
_xlator
Definition: xlator.h:770
NFS3ERR_STALE
@ NFS3ERR_STALE
Definition: xdr-nfs3.h:90
nfs3_local::req
rpcsvc_request_t * req
Definition: nfs3.h:196
symlink3args
Definition: xdr-nfs3.h:552
ia_prot_t::write
uint8_t write
Definition: iatt.h:41
NF3SOCK
@ NF3SOCK
Definition: xdr-nfs3.h:110
nfsstat3_strerror
char * nfsstat3_strerror(int stat)
Definition: nfs3-helpers.c:516
setattr3res::setattr3res_u
union setattr3res::@72 setattr3res_u
write3resok
Definition: xdr-nfs3.h:454
nfs_inode_loc_fill
int nfs_inode_loc_fill(inode_t *inode, loc_t *loc, int how)
Definition: nfs-common.c:170
post_op_attr::attributes
fattr3 attributes
Definition: xdr-nfs3.h:155
nfs-mem-types.h
set_mtime::set_mtime_u
union set_mtime::@69 set_mtime_u
nfs3_log_rename_call
void nfs3_log_rename_call(uint32_t xid, struct nfs3_fh *src, char *sname, struct nfs3_fh *dst, char *dname)
Definition: nfs3-helpers.c:1599
NFS3_NULL
#define NFS3_NULL
Definition: xdr-nfs3.h:1010
mknod3res::mknod3res_u
union mknod3res::@85 mknod3res_u
fsstat3resok::afiles
size3 afiles
Definition: xdr-nfs3.h:824
nfs3_fill_access3res
void nfs3_fill_access3res(access3res *res, nfsstat3 status, int32_t accbits, int32_t reqaccbits)
Definition: nfs3-helpers.c:574
NFS3ERR_NODEV
@ NFS3ERR_NODEV
Definition: xdr-nfs3.h:79
create3res::resok
create3resok resok
Definition: xdr-nfs3.h:513
commit3res
Definition: xdr-nfs3.h:929
access3res::resok
access3resok resok
Definition: xdr-nfs3.h:364
fsinfo3resok::wtmult
uint32 wtmult
Definition: xdr-nfs3.h:859
nfs3_prep_setattr3args
void nfs3_prep_setattr3args(setattr3args *args, struct nfs3_fh *fh)
Definition: nfs3-helpers.c:1145
wcc_data::after
post_op_attr after
Definition: xdr-nfs3.h:177
NFS3ERR_BADTYPE
@ NFS3ERR_BADTYPE
Definition: xdr-nfs3.h:98
rename3resok::todir_wcc
wcc_data todir_wcc
Definition: xdr-nfs3.h:677
iatt::ia_atime
int64_t ia_atime
Definition: iatt.h:57
GF_SET_ATTR_UID
#define GF_SET_ATTR_UID
Definition: xlator.h:29
nfs3_fill_setattr3res
void nfs3_fill_setattr3res(setattr3res *res, nfsstat3 stat, struct iatt *preop, struct iatt *postop, uint64_t deviceid)
Definition: nfs3-helpers.c:1152
NFS3ERR_NOT_SYNC
@ NFS3ERR_NOT_SYNC
Definition: xdr-nfs3.h:93
fsstat3resok::tbytes
size3 tbytes
Definition: xdr-nfs3.h:819
nfs3_fill_readlink3res
void nfs3_fill_readlink3res(readlink3res *res, nfsstat3 stat, char *path, struct iatt *buf, uint64_t deviceid)
Definition: nfs3-helpers.c:1239
_loc::inode
inode_t * inode
Definition: xlator.h:69
nfs_fh3::data_len
u_int data_len
Definition: xdr-nfs3.h:123
nfs3_fh_resolve_root_lookup_cbk
int32_t nfs3_fh_resolve_root_lookup_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, struct iatt *buf, dict_t *xattr, struct iatt *postparent)
Definition: nfs3-helpers.c:3780
_gf_dirent
Definition: gf-dirent.h:35
nfs3_remove_loglevel
int nfs3_remove_loglevel(nfsstat3 stat)
Definition: nfs3-helpers.c:2689
fsinfo3args
Definition: xdr-nfs3.h:847
nfs3_prep_readlink3args
void nfs3_prep_readlink3args(readlink3args *args, struct nfs3_fh *fh)
Definition: nfs3-helpers.c:1232
nfs3_log_create_call
void nfs3_log_create_call(uint32_t xid, struct nfs3_fh *fh, char *name, createmode3 mode)
Definition: nfs3-helpers.c:1616
set_uid3::set_it
bool_t set_it
Definition: xdr-nfs3.h:205
lookup3res::resfail
lookup3resfail resfail
Definition: xdr-nfs3.h:333
ACCESS3_EXECUTE
#define ACCESS3_EXECUTE
Definition: xdr-nfs3.h:342
rename3resok::fromdir_wcc
wcc_data fromdir_wcc
Definition: xdr-nfs3.h:676
nfs3_fill_link3res
void nfs3_fill_link3res(link3res *res, nfsstat3 stat, struct iatt *buf, struct iatt *preparent, struct iatt *postparent, uint64_t deviceid)
Definition: nfs3-helpers.c:1348
symlink3res
Definition: xdr-nfs3.h:570
nfs3_local::resolvefh
struct nfs3_fh resolvefh
Definition: nfs3.h:241
msg-nfs3.h
link3res::link3res_u
union link3res::@89 link3res_u
sattr3::uid
set_uid3 uid
Definition: xdr-nfs3.h:246
gf_nfs_mt_entryp3
@ gf_nfs_mt_entryp3
Definition: nfs-mem-types.h:27
nfs3_cbk_errno_status
nfsstat3 nfs3_cbk_errno_status(int32_t op_ret, int32_t op_errno)
Definition: nfs3-helpers.c:254
nfs3_local::vol
xlator_t * vol
Definition: nfs3.h:197
nfs3_fh
Definition: nfs3-fh.h:33
mkdir3res::mkdir3res_u
union mkdir3res::@82 mkdir3res_u
write3resok::count
count3 count
Definition: xdr-nfs3.h:456
fattr3::type
ftype3 type
Definition: xdr-nfs3.h:136
iatt::ia_type
ia_type_t ia_type
Definition: iatt.h:70
setattr3res::status
nfsstat3 status
Definition: xdr-nfs3.h:304
nfs_lookup
int nfs_lookup(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, fop_lookup_cbk_t cbk, void *local)
Definition: nfs-generics.c:71
write3res::resok
write3resok resok
Definition: xdr-nfs3.h:470
nfs3_errno_to_nfsstat3
nfsstat3 nfs3_errno_to_nfsstat3(int errnum)
Definition: nfs3-helpers.c:138
iatt::ia_size
uint64_t ia_size
Definition: iatt.h:51
post_op_fh3::handle_follows
bool_t handle_follows
Definition: xdr-nfs3.h:182
set_uid3::set_uid3_u
union set_uid3::@65 set_uid3_u
fsinfo3resok::maxfilesize
size3 maxfilesize
Definition: xdr-nfs3.h:861
nfs3_prep_write3args
void nfs3_prep_write3args(write3args *args, struct nfs3_fh *fh)
Definition: nfs3-helpers.c:1407
name
char * name
Definition: xdr-nfs3.h:948
rpcsvc_request_transport
#define rpcsvc_request_transport(req)
Definition: rpcsvc.h:290
commit3res::resok
commit3resok resok
Definition: xdr-nfs3.h:932
pathconf3resok::no_trunc
bool_t no_trunc
Definition: xdr-nfs3.h:890
NFS3ERR_FBIG
@ NFS3ERR_FBIG
Definition: xdr-nfs3.h:83
fsstat3resok::fbytes
size3 fbytes
Definition: xdr-nfs3.h:820
mknod3resok::obj
post_op_fh3 obj
Definition: xdr-nfs3.h:601
NFS3_MKNOD
#define NFS3_MKNOD
Definition: xdr-nfs3.h:1021
readdirp3res::resok
readdirp3resok resok
Definition: xdr-nfs3.h:806
rmdir3res
Definition: xdr-nfs3.h:660
create3args
Definition: xdr-nfs3.h:492
dirlist3::entries
entry3 * entries
Definition: xdr-nfs3.h:740
access3res
Definition: xdr-nfs3.h:361
nfs3_readlink_loglevel
int nfs3_readlink_loglevel(nfsstat3 stat)
Definition: nfs3-helpers.c:2111
nfs3_prep_rmdir3args
void nfs3_prep_rmdir3args(rmdir3args *args, struct nfs3_fh *fh, char *name)
Definition: nfs3-helpers.c:1313
SET_TO_CLIENT_TIME
@ SET_TO_CLIENT_TIME
Definition: xdr-nfs3.h:192
lookup3resfail::dir_attributes
post_op_attr dir_attributes
Definition: xdr-nfs3.h:325
nfs_state
Definition: nfs.h:62
nfs3_prep_mknod3args
void nfs3_prep_mknod3args(mknod3args *args, struct nfs3_fh *fh, char *name)
Definition: nfs3-helpers.c:1257
nfs3_local::stbuf
struct iatt stbuf
Definition: nfs3.h:217
nfs3_prep_remove3args
void nfs3_prep_remove3args(remove3args *args, struct nfs3_fh *fh, char *name)
Definition: nfs3-helpers.c:1305
nfs3_rmdir_loglevel
int nfs3_rmdir_loglevel(nfsstat3 stat)
Definition: nfs3-helpers.c:2763
NF3REG
@ NF3REG
Definition: xdr-nfs3.h:105
offset3
uint64 offset3
Definition: xdr-nfs3.h:53
dirlistp3::eof
bool_t eof
Definition: xdr-nfs3.h:787
IA_PROT_SUID
#define IA_PROT_SUID(prot)
Definition: iatt.h:155
symlink3res::resok
symlink3resok resok
Definition: xdr-nfs3.h:573
GF_SET_ATTR_GID
#define GF_SET_ATTR_GID
Definition: xlator.h:30
__nfs3_fh_auth_get_peer
int __nfs3_fh_auth_get_peer(const rpcsvc_request_t *req, char *peer)
Definition: nfs3-helpers.c:3844
nfs3op_strings
struct nfs3op_str nfs3op_strings[]
Definition: nfs3-helpers.c:3181
NFS3_REMOVE
#define NFS3_REMOVE
Definition: xdr-nfs3.h:1022
nfs3_sattr3_to_setattr_valid
int32_t nfs3_sattr3_to_setattr_valid(sattr3 *sattr, struct iatt *buf, mode_t *omode)
Definition: nfs3-helpers.c:975
pathconf3res::resok
pathconf3resok resok
Definition: xdr-nfs3.h:905
NFS3ERR_TOOSMALL
@ NFS3ERR_TOOSMALL
Definition: xdr-nfs3.h:96
read3resok::count
count3 count
Definition: xdr-nfs3.h:404
NFS3_RMDIR
#define NFS3_RMDIR
Definition: xdr-nfs3.h:1023
NFS3ERR_ACCES
@ NFS3ERR_ACCES
Definition: xdr-nfs3.h:76
nfs3_fill_lookup3res
void nfs3_fill_lookup3res(lookup3res *res, nfsstat3 stat, struct nfs3_fh *newfh, struct iatt *buf, struct iatt *postparent, uint64_t deviceid)
Definition: nfs3-helpers.c:425
IA_PROT_XUSR
#define IA_PROT_XUSR(prot)
Definition: iatt.h:145
syncdaemon.resource.ENOTSUP
ENOTSUP
Definition: resource.py:49
create3resok::obj_attributes
post_op_attr obj_attributes
Definition: xdr-nfs3.h:500
set_uid3::uid
uid3 uid
Definition: xdr-nfs3.h:207
set_gid3::set_it
bool_t set_it
Definition: xdr-nfs3.h:213
set_mode3::mode
mode3 mode
Definition: xdr-nfs3.h:199
ia_major
static uint32_t ia_major(uint64_t ia_dev)
Definition: iatt.h:162
EXCLUSIVE
@ EXCLUSIVE
Definition: xdr-nfs3.h:479
nfs3_accessbits
uint32_t nfs3_accessbits(int32_t accbits)
Definition: nfs3-helpers.c:539
entry3::cookie
cookie3 cookie
Definition: xdr-nfs3.h:734
nfs3_fh_resolve_root
int nfs3_fh_resolve_root(nfs3_call_state_t *cs)
Definition: nfs3-helpers.c:3806
nfs_user_info
Definition: nfs.h:128
GF_LOG_ERROR
@ GF_LOG_ERROR
Definition: logging.h:73
entryp3::fileid
fileid3 fileid
Definition: xdr-nfs3.h:776
write3res::write3res_u
union write3res::@79 write3res_u
fsinfo3resok::properties
uint32 properties
Definition: xdr-nfs3.h:863
POSIX_READ
#define POSIX_READ
Definition: nfs3-helpers.c:534
GF_NFS3_FS_PROP
#define GF_NFS3_FS_PROP
Definition: nfs3.h:84
readdirp3resok::cookieverf
cookieverf3 cookieverf
Definition: xdr-nfs3.h:793
NFS3ERR_NOTDIR
@ NFS3ERR_NOTDIR
Definition: xdr-nfs3.h:80
ia_minor
static uint32_t ia_minor(uint64_t ia_dev)
Definition: iatt.h:168
ACCESS3_MODIFY
#define ACCESS3_MODIFY
Definition: xdr-nfs3.h:339
NF3DIR
@ NF3DIR
Definition: xdr-nfs3.h:106
ia_prot_t::exec
uint8_t exec
Definition: iatt.h:42
nfs3_fill_rename3res
void nfs3_fill_rename3res(rename3res *res, nfsstat3 stat, struct iatt *buf, struct iatt *preoldparent, struct iatt *postoldparent, struct iatt *prenewparent, struct iatt *postnewparent, uint64_t deviceid)
Definition: nfs3-helpers.c:1382
mkdir3res
Definition: xdr-nfs3.h:537
IA_PROT_RGRP
#define IA_PROT_RGRP(prot)
Definition: iatt.h:147
gf_nfs_mt_entry3
@ gf_nfs_mt_entry3
Definition: nfs-mem-types.h:26
commit3res::commit3res_u
union commit3res::@95 commit3res_u
GF_NFS3_RTMULT
#define GF_NFS3_RTMULT
Definition: nfs3.h:53
rename3res::rename3res_u
union rename3res::@88 rename3res_u
nfs3_fsstat_loglevel
int nfs3_fsstat_loglevel(nfsstat3 stat)
Definition: nfs3-helpers.c:3075
mkdir3resok::dir_wcc
wcc_data dir_wcc
Definition: xdr-nfs3.h:528
IA_ISREG
#define IA_ISREG(t)
Definition: iatt.h:134
sattr3::gid
set_gid3 gid
Definition: xdr-nfs3.h:247
pathconf3resok
Definition: xdr-nfs3.h:886
NFS_MSG_INODE_LOC_FILL_ERROR
@ NFS_MSG_INODE_LOC_FILL_ERROR
Definition: nfs-messages.h:100
nfs3_state::writesize
uint64_t writesize
Definition: nfs3.h:141
symlink3res::status
nfsstat3 status
Definition: xdr-nfs3.h:571
readlink3args
Definition: xdr-nfs3.h:370
entry3::name
filename3 name
Definition: xdr-nfs3.h:733
GF_NFS3_TIMEDELTA_SECS
#define GF_NFS3_TIMEDELTA_SECS
Definition: nfs3.h:71
nfs3_prep_lookup3args
void nfs3_prep_lookup3args(lookup3args *args, struct nfs3_fh *fh, char *name)
Definition: nfs3-helpers.c:494
IA_PROT_WOTH
#define IA_PROT_WOTH(prot)
Definition: iatt.h:152
fsinfo3res::fsinfo3res_u
union fsinfo3res::@93 fsinfo3res_u
symlink3resok::obj
post_op_fh3 obj
Definition: xdr-nfs3.h:559
nfs3op_str::str
char str[100]
Definition: nfs3-helpers.c:3178
NFS3_GETATTR
#define NFS3_GETATTR
Definition: xdr-nfs3.h:1011
NFS3MODE_XOWNER
#define NFS3MODE_XOWNER
Definition: xdr-nfs3.h:62
nfs3_fh_compute_size
uint32_t nfs3_fh_compute_size()
Definition: nfs3-fh.c:183
NFS3ERR_BAD_COOKIE
@ NFS3ERR_BAD_COOKIE
Definition: xdr-nfs3.h:94
_xlator::itable
inode_table_t * itable
Definition: xlator.h:820
nfs3stat_strerror::stat
nfsstat3 stat
Definition: nfs3-helpers.c:49
entryp3::name_handle
post_op_fh3 name_handle
Definition: xdr-nfs3.h:780
mknod3resok::dir_wcc
wcc_data dir_wcc
Definition: xdr-nfs3.h:603
write3res
Definition: xdr-nfs3.h:467
nfs3_local::nfs3state
struct nfs3_state * nfs3state
Definition: nfs3.h:200
readdirp3resok::dir_attributes
post_op_attr dir_attributes
Definition: xdr-nfs3.h:792
iatt::ia_nlink
uint32_t ia_nlink
Definition: iatt.h:52
sattr3
Definition: xdr-nfs3.h:244
nfs3_fill_fsinfo3res
void nfs3_fill_fsinfo3res(struct nfs3_state *nfs3, fsinfo3res *res, nfsstat3 status, struct iatt *fsroot, uint64_t deviceid)
Definition: nfs3-helpers.c:464
set_mtime::mtime
nfstime3 mtime
Definition: xdr-nfs3.h:239
nfs3_free_readdir3res
void nfs3_free_readdir3res(readdir3res *res)
Definition: nfs3-helpers.c:922
NFS3_ENTRYP3_FIXED_SIZE
#define NFS3_ENTRYP3_FIXED_SIZE
Definition: xdr-nfs3.h:36
access3args
Definition: xdr-nfs3.h:344
NFS3_READLINK
#define NFS3_READLINK
Definition: xdr-nfs3.h:1015
pre_op_attr
Definition: xdr-nfs3.h:167
nfs3_fh_to_post_op_fh3
post_op_fh3 nfs3_fh_to_post_op_fh3(struct nfs3_fh *fh)
Definition: nfs3-helpers.c:695
nfs3_log_readdir_call
void nfs3_log_readdir_call(uint32_t xid, struct nfs3_fh *fh, count3 dircount, count3 maxcount)
Definition: nfs3-helpers.c:3479
NFS3_COMMIT
#define NFS3_COMMIT
Definition: xdr-nfs3.h:1031
NFS3ERR_SERVERFAULT
@ NFS3ERR_SERVERFAULT
Definition: xdr-nfs3.h:97
link3res::status
nfsstat3 status
Definition: xdr-nfs3.h:715
entryp3
Definition: xdr-nfs3.h:775
create3res
Definition: xdr-nfs3.h:510
inode_link
inode_t * inode_link(inode_t *inode, inode_t *parent, const char *name, struct iatt *stbuf)
Definition: inode.c:1062
nfs3_prep_access3args
void nfs3_prep_access3args(access3args *args, struct nfs3_fh *fh)
Definition: nfs3-helpers.c:528
symlink3resok::obj_attributes
post_op_attr obj_attributes
Definition: xdr-nfs3.h:560
getattr3args
Definition: xdr-nfs3.h:260
fsstat3resok
Definition: xdr-nfs3.h:817
gf_nfs_enable_ino32
#define gf_nfs_enable_ino32()
Definition: nfs.h:118
nfs3_fill_mknod3res
void nfs3_fill_mknod3res(mknod3res *res, nfsstat3 stat, struct nfs3_fh *fh, struct iatt *buf, struct iatt *preparent, struct iatt *postparent, uint64_t deviceid)
Definition: nfs3-helpers.c:1265
nfs3_local::nfsx
xlator_t * nfsx
Definition: nfs3.h:199
IA_PROT_WUSR
#define IA_PROT_WUSR(prot)
Definition: iatt.h:144
set_size3::set_size3_u
union set_size3::@67 set_size3_u
set_size3::set_it
bool_t set_it
Definition: xdr-nfs3.h:221
NFS3_LINK
#define NFS3_LINK
Definition: xdr-nfs3.h:1025
access3resok::access
uint32 access
Definition: xdr-nfs3.h:352
setattr3args
Definition: xdr-nfs3.h:286
nfs3_prep_symlink3args
void nfs3_prep_symlink3args(symlink3args *args, struct nfs3_fh *dirfh, char *name, char *target)
Definition: nfs3-helpers.c:1199
NF3FIFO
@ NF3FIFO
Definition: xdr-nfs3.h:111
nfs3_fh::gfid
uuid_t gfid
Definition: nfs3-fh.h:52
fsinfo3resok::rtmax
uint32 rtmax
Definition: xdr-nfs3.h:854
fsstat3resok::tfiles
size3 tfiles
Definition: xdr-nfs3.h:822
commit3res::status
nfsstat3 status
Definition: xdr-nfs3.h:930
RPCSVC_PEER_STRLEN
#define RPCSVC_PEER_STRLEN
Definition: rpcsvc.h:547
lookup3res::status
nfsstat3 status
Definition: xdr-nfs3.h:330
IA_ISSOCK
#define IA_ISSOCK(t)
Definition: iatt.h:140
NF3CHR
@ NF3CHR
Definition: xdr-nfs3.h:108
readlink3res::readlink3res_u
union readlink3res::@75 readlink3res_u
NFS3_READDIR
#define NFS3_READDIR
Definition: xdr-nfs3.h:1026
nfs3_lookup_loglevel
int nfs3_lookup_loglevel(nfsstat3 stat)
Definition: nfs3-helpers.c:1919
nfs_hash_gfid
uint32_t nfs_hash_gfid(uuid_t gfid)
Definition: nfs-common.c:387
fsinfo3res
Definition: xdr-nfs3.h:872
mknod3resok::obj_attributes
post_op_attr obj_attributes
Definition: xdr-nfs3.h:602
create3resok::dir_wcc
wcc_data dir_wcc
Definition: xdr-nfs3.h:501
nfs3_prep_mkdir3args
void nfs3_prep_mkdir3args(mkdir3args *args, struct nfs3_fh *dirfh, char *name)
Definition: nfs3-helpers.c:1168
nfs3_fh_resolve_inode_done
int nfs3_fh_resolve_inode_done(nfs3_call_state_t *cs, inode_t *inode)
Definition: nfs3-helpers.c:3502
wcc_attr::mtime
nfstime3 mtime
Definition: xdr-nfs3.h:162
inode_lookup
int inode_lookup(inode_t *inode)
Definition: inode.c:1099
nfs3_state::readsize
uint64_t readsize
Definition: nfs3.h:140
nfs3_is_root_looked_up
int nfs3_is_root_looked_up(struct nfs3_state *nfs3, struct nfs3_fh *rootfh)
Definition: nfs3.c:170
nfs3_fill_entryp3
entryp3 * nfs3_fill_entryp3(gf_dirent_t *entry, struct nfs3_fh *dirfh, uint64_t devid)
Definition: nfs3-helpers.c:717
entryp3::name_attributes
post_op_attr name_attributes
Definition: xdr-nfs3.h:779
_dict
Definition: dict.h:114
_loc::path
const char * path
Definition: xlator.h:67
read3resok::data
struct read3resok::@76 data
nfs3_local::resolvedloc
loc_t resolvedloc
Definition: nfs3.h:242
NFS3MODE_WGROUP
#define NFS3MODE_WGROUP
Definition: xdr-nfs3.h:64
src
Definition: __init__.py:1
GF_CALLOC
#define GF_CALLOC(nmemb, size, type)
Definition: mem-pool.h:153
pathconf3resok::chown_restricted
bool_t chown_restricted
Definition: xdr-nfs3.h:891
common-utils.h
write3resok::verf
writeverf3 verf
Definition: xdr-nfs3.h:458
nfs3_prep_link3args
void nfs3_prep_link3args(link3args *args, struct nfs3_fh *target, struct nfs3_fh *dirfh, char *name)
Definition: nfs3-helpers.c:1338
NFS3ERR_MLINK
@ NFS3ERR_MLINK
Definition: xdr-nfs3.h:86
S40ufo-stop.op
op
Definition: S40ufo-stop.py:14
nfs3_fill_entry3
entry3 * nfs3_fill_entry3(gf_dirent_t *entry, struct nfs3_fh *dfh)
Definition: nfs3-helpers.c:643
nfs3_map_deviceid_to_statdev
void nfs3_map_deviceid_to_statdev(struct iatt *ia, uint64_t deviceid)
Definition: nfs3-helpers.c:108
inode_find
inode_t * inode_find(inode_table_t *table, uuid_t gfid)
Definition: inode.c:923
link3args
Definition: xdr-nfs3.h:696
wcc_attr::ctime
nfstime3 ctime
Definition: xdr-nfs3.h:163
NFS3MODE_ROWNER
#define NFS3MODE_ROWNER
Definition: xdr-nfs3.h:60
gf_uuid_copy
static void gf_uuid_copy(uuid_t dst, const uuid_t src)
Definition: compat-uuid.h:29
NFS_MSG_LOOKUP_FAIL
@ NFS_MSG_LOOKUP_FAIL
Definition: nfs-messages.h:100
nfs3_fh_resolve_entry_hard
int nfs3_fh_resolve_entry_hard(nfs3_call_state_t *cs)
Definition: nfs3-helpers.c:3659
nfs3_rename_loglevel
int nfs3_rename_loglevel(nfsstat3 stat)
Definition: nfs3-helpers.c:2837
NFS_NAME_MAX
#define NFS_NAME_MAX
Definition: nfs-common.h:24
setattr3res::resok
setattr3resok resok
Definition: xdr-nfs3.h:306
fattr3::used
size3 used
Definition: xdr-nfs3.h:142
_loc::gfid
uuid_t gfid
Definition: xlator.h:77
nfs-fops.h
nfs3_fh_resolve_inode
int nfs3_fh_resolve_inode(nfs3_call_state_t *cs)
Definition: nfs3-helpers.c:3716
sattr3::atime
set_atime atime
Definition: xdr-nfs3.h:249
NF3LNK
@ NF3LNK
Definition: xdr-nfs3.h:109
IA_ISBLK
#define IA_ISBLK(t)
Definition: iatt.h:137
nfs3_local::hardresolved
int hardresolved
Definition: nfs3.h:240
post_op_attr
Definition: xdr-nfs3.h:152
fsinfo3resok::obj_attributes
post_op_attr obj_attributes
Definition: xdr-nfs3.h:853
ACCESS3_READ
#define ACCESS3_READ
Definition: xdr-nfs3.h:337
_gf_dirent::d_ino
uint64_t d_ino
Definition: gf-dirent.h:43
fsinfo3resok::dtpref
uint32 dtpref
Definition: xdr-nfs3.h:860
nfs3_log_readlink_res
void nfs3_log_readlink_res(uint32_t xid, nfsstat3 stat, int pstat, char *linkpath, const char *path)
Definition: nfs3-helpers.c:3312
entry3::nextentry
struct entry3 * nextentry
Definition: xdr-nfs3.h:735
rmdir3resok::dir_wcc
wcc_data dir_wcc
Definition: xdr-nfs3.h:651
fsstat3res
Definition: xdr-nfs3.h:834
rmdir3res::rmdir3res_u
union rmdir3res::@87 rmdir3res_u
nfs3_fill_lookup3res_error
void nfs3_fill_lookup3res_error(lookup3res *res, nfsstat3 stat, struct iatt *dirstat)
Definition: nfs3-helpers.c:264
gf_strdup
static char * gf_strdup(const char *src)
Definition: mem-pool.h:182
nfs3_create_exclusive_op
#define nfs3_create_exclusive_op(cst)
Definition: nfs3.h:273
err
#define err(x...)
Definition: gcrawler.c:34
UNSTABLE
@ UNSTABLE
Definition: xdr-nfs3.h:428
readdirp3res::status
nfsstat3 status
Definition: xdr-nfs3.h:804
commit3args
Definition: xdr-nfs3.h:911
nfs3_symlink_loglevel
int nfs3_symlink_loglevel(nfsstat3 stat)
Definition: nfs3-helpers.c:2541
nfs3_fill_read3res
void nfs3_fill_read3res(read3res *res, nfsstat3 stat, count3 count, struct iatt *poststat, int is_eof, uint64_t deviceid)
Definition: nfs3-helpers.c:1458
fsstat3args
Definition: xdr-nfs3.h:812
S40ufo-stop.type
type
Definition: S40ufo-stop.py:15
fattr3::nlink
uint32 nlink
Definition: xdr-nfs3.h:138
count3
uint32 count3
Definition: xdr-nfs3.h:55
iatt::ia_ino
uint64_t ia_ino
Definition: iatt.h:48
nfs3_extract_getattr_fh
struct nfs3_fh nfs3_extract_getattr_fh(getattr3args *args)
Definition: nfs3-helpers.c:439
nfs-messages.h
fsstat3resok::ffiles
size3 ffiles
Definition: xdr-nfs3.h:823
readdirp3args
Definition: xdr-nfs3.h:766
nfs3_stat_to_errstr
void nfs3_stat_to_errstr(uint32_t xid, char *op, nfsstat3 stat, int pstat, char *errstr, size_t len)
Definition: nfs3-helpers.c:1564
ia_prot_t::sticky
uint8_t sticky
Definition: iatt.h:38
fattr3::fsid
uint64 fsid
Definition: xdr-nfs3.h:144
read3resok::file_attributes
post_op_attr file_attributes
Definition: xdr-nfs3.h:403
nfs3_local::resolve_errno
int resolve_errno
Definition: nfs3.h:244
gf_msg_trace
#define gf_msg_trace(dom, errnum, fmt...)
Definition: logging.h:276
GF_MALLOC
#define GF_MALLOC(size, type)
Definition: mem-pool.h:155
nfs3_fill_readdirp3res
void nfs3_fill_readdirp3res(readdirp3res *res, nfsstat3 stat, struct nfs3_fh *dirfh, uint64_t cverf, struct iatt *dirstat, gf_dirent_t *entries, count3 dircount, count3 maxcount, int is_eof, uint64_t deviceid)
Definition: nfs3-helpers.c:833
NFS3MODE_SETXUID
#define NFS3MODE_SETXUID
Definition: xdr-nfs3.h:57
create3res::create3res_u
union create3res::@81 create3res_u
nfs3_prep_read3args
void nfs3_prep_read3args(read3args *args, struct nfs3_fh *fh)
Definition: nfs3-helpers.c:1477
NFS3ERR_DQUOT
@ NFS3ERR_DQUOT
Definition: xdr-nfs3.h:89
sattr3::mtime
set_mtime mtime
Definition: xdr-nfs3.h:250
_loc::name
const char * name
Definition: xlator.h:68
GF_SET_ATTR_ATIME
#define GF_SET_ATTR_ATIME
Definition: xlator.h:32
iatt::ia_rdev
uint64_t ia_rdev
Definition: iatt.h:50
NFS3MODE_XOTHER
#define NFS3MODE_XOTHER
Definition: xdr-nfs3.h:68
readdirp3args::dir
nfs_fh3 dir
Definition: xdr-nfs3.h:767
nfs3_getattr_loglevel
int nfs3_getattr_loglevel(nfsstat3 stat)
Definition: nfs3-helpers.c:1723
NFS3_FSSTAT
#define NFS3_FSSTAT
Definition: xdr-nfs3.h:1028
NFS3ERR_NOTSUPP
@ NFS3ERR_NOTSUPP
Definition: xdr-nfs3.h:95
nfs3_fill_pathconf3res
void nfs3_fill_pathconf3res(pathconf3res *res, nfsstat3 stat, struct iatt *buf, uint64_t deviceid)
Definition: nfs3-helpers.c:1484
link3resok::linkdir_wcc
wcc_data linkdir_wcc
Definition: xdr-nfs3.h:704
mount3.h
rmdir3res::resok
rmdir3resok resok
Definition: xdr-nfs3.h:663