diff options
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/nfs/server/src/nfs.c | 28 | ||||
-rw-r--r-- | xlators/nfs/server/src/nfs3-helpers.c | 13 | ||||
-rw-r--r-- | xlators/nfs/server/src/nfs3-helpers.h | 4 |
3 files changed, 39 insertions, 6 deletions
diff --git a/xlators/nfs/server/src/nfs.c b/xlators/nfs/server/src/nfs.c index 2bc20d04e..b4568f519 100644 --- a/xlators/nfs/server/src/nfs.c +++ b/xlators/nfs/server/src/nfs.c @@ -39,6 +39,7 @@ #include "mount3.h" #include "nfs3.h" #include "nfs-mem-types.h" +#include "nfs3-helpers.h" /* Every NFS version must call this function with the init function * for its particular version. @@ -728,7 +729,32 @@ fini (xlator_t *this) return 0; } -struct xlator_cbks cbks = { }; +int32_t +nfs_forget (xlator_t *this, inode_t *inode) +{ + int32_t ret = -1; + uint64_t ctx = 0; + struct inode_op_queue *inode_q = NULL; + + if (!inode || !this) + return 0; + ret = inode_ctx_del (inode, this, &ctx); + if (!ret && ctx && !(IA_ISDIR (inode->ia_type))) { + inode_q = (struct inode_op_queue *) (long) ctx; + pthread_mutex_lock (&inode_q->qlock); + { + nfs3_flush_inode_queue (inode_q, NULL, 0); + } + pthread_mutex_unlock (&inode_q->qlock); + } + + return 0; +} + +struct xlator_cbks cbks = { + .forget = nfs_forget, +}; + struct xlator_fops fops = { }; /* TODO: If needed, per-volume options below can be extended to be export diff --git a/xlators/nfs/server/src/nfs3-helpers.c b/xlators/nfs/server/src/nfs3-helpers.c index 523fdaee9..0b39e3d16 100644 --- a/xlators/nfs/server/src/nfs3-helpers.c +++ b/xlators/nfs/server/src/nfs3-helpers.c @@ -1726,7 +1726,8 @@ err: int -nfs3_flush_call_state (nfs3_call_state_t *cs, fd_t *openedfd) +nfs3_flush_call_state (nfs3_call_state_t *cs, fd_t *openedfd, + int32_t call_resume) { if ((!cs)) return -1; @@ -1745,14 +1746,16 @@ nfs3_flush_call_state (nfs3_call_state_t *cs, fd_t *openedfd) cs->resolve_ret = 0; } list_del (&cs->openwait_q); - nfs3_call_resume (cs); + if (call_resume) + nfs3_call_resume (cs); return 0; } int -nfs3_flush_inode_queue (struct inode_op_queue *inode_q, fd_t *openedfd) +nfs3_flush_inode_queue (struct inode_op_queue *inode_q, fd_t *openedfd, + int32_t call_resume) { nfs3_call_state_t *cstmp = NULL; nfs3_call_state_t *cs = NULL; @@ -1761,7 +1764,7 @@ nfs3_flush_inode_queue (struct inode_op_queue *inode_q, fd_t *openedfd) return -1; list_for_each_entry_safe (cs, cstmp, &inode_q->opq, openwait_q) - nfs3_flush_call_state (cs, openedfd); + nfs3_flush_call_state (cs, openedfd, call_resume); return 0; } @@ -1790,7 +1793,7 @@ nfs3_flush_open_wait_call_states (nfs3_call_state_t *cs, fd_t *openedfd) pthread_mutex_lock (&inode_q->qlock); { - nfs3_flush_inode_queue (inode_q, openedfd); + nfs3_flush_inode_queue (inode_q, openedfd, 1); } pthread_mutex_unlock (&inode_q->qlock); diff --git a/xlators/nfs/server/src/nfs3-helpers.h b/xlators/nfs/server/src/nfs3-helpers.h index 302d731d1..1396a0396 100644 --- a/xlators/nfs/server/src/nfs3-helpers.h +++ b/xlators/nfs/server/src/nfs3-helpers.h @@ -347,4 +347,8 @@ nfs3_is_parentdir_entry (char *entry); uint32_t nfs3_request_to_accessbits (int32_t accbits); + +int +nfs3_flush_inode_queue (struct inode_op_queue *inode_q, fd_t *openedfd, + int32_t call_resume); #endif |