* [PATH v5 0/8] process current stateid
@ 2012-01-06 9:45 Tigran Mkrtchyan
2012-01-06 9:45 ` [PATH v5 1/8] nfsd4: initialize special stateid's at compile time Tigran Mkrtchyan
` (8 more replies)
0 siblings, 9 replies; 11+ messages in thread
From: Tigran Mkrtchyan @ 2012-01-06 9:45 UTC (permalink / raw)
To: linux-nfs; +Cc: Tigran Mkrtchyan
From: Tigran Mkrtchyan <kofemann@gmail.com>
Yet another update (v5) of current stateid handling
re-based to Benny's git branch pnfs-all-latest ( to include PNFS operations )
Includes a patch from Bruce f32f3c2d3f09a586349ca9180885dc8741290fd9
I have tested:
OPEN+READ+CLOSE
OPEN+WRITE+CLOSE
OPEN+LOCK+WRITE+LOCKU+CLOSE
OPEN+PUTROOTFH+CLOSE
implemented but not tested
OPEN+LAYOUTGET
Tigran.
Tigran Mkrtchyan (8):
nfsd4: initialize special stateid's at compile time
nfsd41: handle current stateid in open and close
nfsd41: handle current stateid on lock and locku
nfsd41: consume current stateid on read and write
nfsd41: mark PUTFH, PUTPUBFH and PUTROOTFH to clear current stateid
nfsd41: save and restore current stateid with current fh
nfsd41: mark LOOKUP, LOOKUPP and CREATE to invalidate current stateid
nfsv41: handle current stateid on LAYOUTGET
fs/nfsd/current_stateid.h | 23 +++++++++++
fs/nfsd/nfs4proc.c | 53 ++++++++++++++++++++-----
fs/nfsd/nfs4state.c | 95 ++++++++++++++++++++++++++++++++++++++++++--
fs/nfsd/xdr4.h | 2 +
4 files changed, 158 insertions(+), 15 deletions(-)
create mode 100644 fs/nfsd/current_stateid.h
--
1.7.7.5
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATH v5 1/8] nfsd4: initialize special stateid's at compile time
2012-01-06 9:45 [PATH v5 0/8] process current stateid Tigran Mkrtchyan
@ 2012-01-06 9:45 ` Tigran Mkrtchyan
2012-01-06 9:45 ` [PATH v5 2/8] nfsd41: handle current stateid in open and close Tigran Mkrtchyan
` (7 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Tigran Mkrtchyan @ 2012-01-06 9:45 UTC (permalink / raw)
To: linux-nfs; +Cc: Tigran Mkrtchyan, J. Bruce Fields
From: Tigran Mkrtchyan <kofemann@gmail.com>
Stateid's with "other" ("opaque") field all zeros or all ones are
reserved. We define all_ones separately on the off chance there will be
more such some day, though currently all the other special stateid's
have zero other field.
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Conflicts:
fs/nfsd/nfs4state.c
Conflicts:
fs/nfsd/nfs4state.c
Signed-off-by: Tigran Mkrtchyan <kofemann@gmail.com>
---
fs/nfsd/nfs4state.c | 21 ++++++++++++++++-----
1 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index a62dbc9..40d3bdf 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -51,12 +51,24 @@
time_t nfsd4_lease = 90; /* default lease time */
time_t nfsd4_grace = 90;
static time_t boot_time;
-static stateid_t zerostateid; /* bits all 0 */
-static stateid_t onestateid; /* bits all 1 */
+
+#define all_ones {{~0,~0},~0}
+static const stateid_t one_stateid = {
+ .si_generation = ~0,
+ .si_opaque = all_ones,
+};
+static const stateid_t zero_stateid = {
+ /* all fields zero */
+};
+static const stateid_t currentstateid = {
+ .si_generation = 1,
+};
+
static u64 current_sessionid = 1;
-#define ZERO_STATEID(stateid) (!memcmp((stateid), &zerostateid, sizeof(stateid_t)))
-#define ONE_STATEID(stateid) (!memcmp((stateid), &onestateid, sizeof(stateid_t)))
+#define ZERO_STATEID(stateid) (!memcmp((stateid), &zero_stateid, sizeof(stateid_t)))
+#define ONE_STATEID(stateid) (!memcmp((stateid), &one_stateid, sizeof(stateid_t)))
+#define CURRENT_STATEID(stateid) (!memcmp((stateid), ¤tstateid, sizeof(stateid_t)))
/* forward declarations */
static int check_for_locks(struct nfs4_file *filp, struct nfs4_lockowner *lowner);
@@ -4569,7 +4581,6 @@ nfs4_state_init(void)
for (i = 0; i < LOCK_HASH_SIZE; i++) {
INIT_LIST_HEAD(&lock_ownerstr_hashtbl[i]);
}
- memset(&onestateid, ~0, sizeof(stateid_t));
INIT_LIST_HEAD(&close_lru);
INIT_LIST_HEAD(&client_lru);
INIT_LIST_HEAD(&del_recall_lru);
--
1.7.7.5
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATH v5 2/8] nfsd41: handle current stateid in open and close
2012-01-06 9:45 [PATH v5 0/8] process current stateid Tigran Mkrtchyan
2012-01-06 9:45 ` [PATH v5 1/8] nfsd4: initialize special stateid's at compile time Tigran Mkrtchyan
@ 2012-01-06 9:45 ` Tigran Mkrtchyan
2012-01-06 9:45 ` [PATH v5 3/8] nfsd41: handle current stateid on lock and locku Tigran Mkrtchyan
` (6 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Tigran Mkrtchyan @ 2012-01-06 9:45 UTC (permalink / raw)
To: linux-nfs; +Cc: Tigran Mkrtchyan
From: Tigran Mkrtchyan <kofemann@gmail.com>
Signed-off-by: Tigran Mkrtchyan <kofemann@gmail.com>
---
fs/nfsd/current_stateid.h | 11 +++++++++++
fs/nfsd/nfs4proc.c | 30 ++++++++++++++++++++++++++----
fs/nfsd/nfs4state.c | 32 ++++++++++++++++++++++++++++++++
fs/nfsd/xdr4.h | 1 +
4 files changed, 70 insertions(+), 4 deletions(-)
create mode 100644 fs/nfsd/current_stateid.h
diff --git a/fs/nfsd/current_stateid.h b/fs/nfsd/current_stateid.h
new file mode 100644
index 0000000..a83dd50
--- /dev/null
+++ b/fs/nfsd/current_stateid.h
@@ -0,0 +1,11 @@
+#ifndef _NFSD4_CURRENT_STATE_H
+#define _NFSD4_CURRENT_STATE_H
+
+#include "state.h"
+#include "xdr4.h"
+
+extern void nfsd4_set_openstateid(struct nfsd4_compound_state *, struct nfsd4_open *);
+extern void nfsd4_get_closestateid(struct nfsd4_compound_state *, struct nfsd4_close *);
+extern void nfsd4_set_closestateid(struct nfsd4_compound_state *, struct nfsd4_close *);
+
+#endif /* _NFSD4_CURRENT_STATE_H */
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index aa79a45..07fb673 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -42,6 +42,7 @@
#include "vfs.h"
#include "pnfsd.h"
#include "nfsd4_block.h"
+#include "current_stateid.h"
#define NFSDDBG_FACILITY NFSDDBG_PROC
@@ -1318,6 +1319,8 @@ static inline void nfsd4_increment_op_stats(u32 opnum)
typedef __be32(*nfsd4op_func)(struct svc_rqst *, struct nfsd4_compound_state *,
void *);
typedef u32(*nfsd4op_rsize)(struct svc_rqst *, struct nfsd4_op *op);
+typedef void(*stateid_setter)(struct nfsd4_compound_state *, void *);
+typedef void(*stateid_getter)(struct nfsd4_compound_state *, void *);
enum nfsd4_op_flags {
ALLOWED_WITHOUT_FH = 1 << 0, /* No current filehandle required */
@@ -1343,6 +1346,10 @@ enum nfsd4_op_flags {
* the v4.0 case).
*/
OP_CACHEME = 1 << 6,
+ /*
+ * These are ops which clear current state id.
+ */
+ OP_CLEAR_STATEID = 1 << 7,
};
struct nfsd4_operation {
@@ -1351,6 +1358,8 @@ struct nfsd4_operation {
char *op_name;
/* Try to get response size before operation */
nfsd4op_rsize op_rsize_bop;
+ stateid_setter op_get_currentstateid;
+ stateid_getter op_set_currentstateid;
};
static struct nfsd4_operation nfsd4_ops[];
@@ -1533,13 +1542,23 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
if (op->status)
goto encode_op;
- if (opdesc->op_func)
+ if (opdesc->op_func) {
+ if (opdesc->op_get_currentstateid)
+ opdesc->op_get_currentstateid(cstate, &op->u);
op->status = opdesc->op_func(rqstp, cstate, &op->u);
- else
+ } else
BUG_ON(op->status == nfs_ok);
- if (!op->status && need_wrongsec_check(rqstp))
- op->status = check_nfsd_access(cstate->current_fh.fh_export, rqstp);
+ if (!op->status) {
+ if (opdesc->op_set_currentstateid)
+ opdesc->op_set_currentstateid(cstate, &op->u);
+
+ if (opdesc->op_flags & OP_CLEAR_STATEID)
+ cstate->current_stateid = NULL;
+
+ if (need_wrongsec_check(rqstp))
+ op->status = check_nfsd_access(cstate->current_fh.fh_export, rqstp);
+ }
encode_op:
/* Only from SEQUENCE */
@@ -1731,6 +1750,8 @@ static struct nfsd4_operation nfsd4_ops[] = {
.op_flags = OP_MODIFIES_SOMETHING,
.op_name = "OP_CLOSE",
.op_rsize_bop = (nfsd4op_rsize)nfsd4_status_stateid_rsize,
+ .op_get_currentstateid = (stateid_getter)nfsd4_get_closestateid,
+ .op_set_currentstateid = (stateid_setter)nfsd4_set_closestateid,
},
[OP_COMMIT] = {
.op_func = (nfsd4op_func)nfsd4_commit,
@@ -1801,6 +1822,7 @@ static struct nfsd4_operation nfsd4_ops[] = {
.op_flags = OP_HANDLES_WRONGSEC | OP_MODIFIES_SOMETHING,
.op_name = "OP_OPEN",
.op_rsize_bop = (nfsd4op_rsize)nfsd4_open_rsize,
+ .op_set_currentstateid = (stateid_setter)nfsd4_set_openstateid,
},
[OP_OPEN_CONFIRM] = {
.op_func = (nfsd4op_func)nfsd4_open_confirm,
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 40d3bdf..f9f27f4 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -4707,3 +4707,35 @@ nfs4_state_shutdown(void)
nfs4_unlock_state();
nfsd4_destroy_callback_queue();
}
+
+static void
+get_stateid(struct nfsd4_compound_state *cstate, stateid_t *stateid)
+{
+ if (cstate->current_stateid && CURRENT_STATEID(stateid))
+ memcpy(stateid, cstate->current_stateid, sizeof(stateid_t));
+}
+
+static void
+put_stateid(struct nfsd4_compound_state *cstate, stateid_t *stateid)
+{
+ if (cstate->minorversion)
+ cstate->current_stateid = stateid;
+}
+
+void
+nfsd4_set_openstateid(struct nfsd4_compound_state *cstate, struct nfsd4_open *open)
+{
+ put_stateid(cstate, &open->op_stateid);
+}
+
+void
+nfsd4_get_closestateid(struct nfsd4_compound_state *cstate, struct nfsd4_close *close)
+{
+ get_stateid(cstate, &close->cl_stateid);
+}
+
+void
+nfsd4_set_closestateid(struct nfsd4_compound_state *cstate, struct nfsd4_close *close)
+{
+ get_stateid(cstate, &close->cl_stateid);
+}
diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h
index 7b08045..7ec4e4f 100644
--- a/fs/nfsd/xdr4.h
+++ b/fs/nfsd/xdr4.h
@@ -56,6 +56,7 @@ struct nfsd4_compound_state {
size_t iovlen;
u32 minorversion;
u32 status;
+ const stateid_t *current_stateid;
};
static inline bool nfsd4_has_session(struct nfsd4_compound_state *cs)
--
1.7.7.5
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATH v5 3/8] nfsd41: handle current stateid on lock and locku
2012-01-06 9:45 [PATH v5 0/8] process current stateid Tigran Mkrtchyan
2012-01-06 9:45 ` [PATH v5 1/8] nfsd4: initialize special stateid's at compile time Tigran Mkrtchyan
2012-01-06 9:45 ` [PATH v5 2/8] nfsd41: handle current stateid in open and close Tigran Mkrtchyan
@ 2012-01-06 9:45 ` Tigran Mkrtchyan
2012-01-06 9:45 ` [PATH v5 4/8] nfsd41: consume current stateid on read and write Tigran Mkrtchyan
` (5 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Tigran Mkrtchyan @ 2012-01-06 9:45 UTC (permalink / raw)
To: linux-nfs; +Cc: Tigran Mkrtchyan
From: Tigran Mkrtchyan <kofemann@gmail.com>
plus minor fixes
Conflicts:
fs/nfsd/nfs4proc.c
Signed-off-by: Tigran Mkrtchyan <kofemann@gmail.com>
---
fs/nfsd/current_stateid.h | 11 ++++++++++-
fs/nfsd/nfs4proc.c | 2 ++
fs/nfsd/nfs4state.c | 22 ++++++++++++++++++++--
3 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/fs/nfsd/current_stateid.h b/fs/nfsd/current_stateid.h
index a83dd50..21550b6 100644
--- a/fs/nfsd/current_stateid.h
+++ b/fs/nfsd/current_stateid.h
@@ -4,8 +4,17 @@
#include "state.h"
#include "xdr4.h"
+/*
+ * functions to set current state id
+ */
extern void nfsd4_set_openstateid(struct nfsd4_compound_state *, struct nfsd4_open *);
-extern void nfsd4_get_closestateid(struct nfsd4_compound_state *, struct nfsd4_close *);
+extern void nfsd4_set_lockstateid(struct nfsd4_compound_state *, struct nfsd4_lock *);
extern void nfsd4_set_closestateid(struct nfsd4_compound_state *, struct nfsd4_close *);
+/*
+ * functions to consume current state id
+ */
+extern void nfsd4_get_closestateid(struct nfsd4_compound_state *, struct nfsd4_close *);
+extern void nfsd4_get_lockustateid(struct nfsd4_compound_state *, struct nfsd4_locku *);
+
#endif /* _NFSD4_CURRENT_STATE_H */
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 07fb673..3e7b97f 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -1792,6 +1792,7 @@ static struct nfsd4_operation nfsd4_ops[] = {
.op_flags = OP_MODIFIES_SOMETHING,
.op_name = "OP_LOCK",
.op_rsize_bop = (nfsd4op_rsize)nfsd4_lock_rsize,
+ .op_set_currentstateid = (stateid_setter)nfsd4_set_lockstateid,
},
[OP_LOCKT] = {
.op_func = (nfsd4op_func)nfsd4_lockt,
@@ -1802,6 +1803,7 @@ static struct nfsd4_operation nfsd4_ops[] = {
.op_flags = OP_MODIFIES_SOMETHING,
.op_name = "OP_LOCKU",
.op_rsize_bop = (nfsd4op_rsize)nfsd4_status_stateid_rsize,
+ .op_get_currentstateid = (stateid_getter)nfsd4_get_lockustateid,
},
[OP_LOOKUP] = {
.op_func = (nfsd4op_func)nfsd4_lookup,
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index f9f27f4..5add33f8 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -4722,6 +4722,9 @@ put_stateid(struct nfsd4_compound_state *cstate, stateid_t *stateid)
cstate->current_stateid = stateid;
}
+/*
+ * functions to set current state id
+ */
void
nfsd4_set_openstateid(struct nfsd4_compound_state *cstate, struct nfsd4_open *open)
{
@@ -4729,13 +4732,28 @@ nfsd4_set_openstateid(struct nfsd4_compound_state *cstate, struct nfsd4_open *op
}
void
+nfsd4_set_closestateid(struct nfsd4_compound_state *cstate, struct nfsd4_close *close)
+{
+ put_stateid(cstate, &close->cl_stateid);
+}
+
+void
+nfsd4_set_lockstateid(struct nfsd4_compound_state *cstate, struct nfsd4_lock *lock)
+{
+ put_stateid(cstate, &lock->lk_resp_stateid);
+}
+
+/*
+ * functions to consume current state id
+ */
+void
nfsd4_get_closestateid(struct nfsd4_compound_state *cstate, struct nfsd4_close *close)
{
get_stateid(cstate, &close->cl_stateid);
}
void
-nfsd4_set_closestateid(struct nfsd4_compound_state *cstate, struct nfsd4_close *close)
+nfsd4_get_lockustateid(struct nfsd4_compound_state *cstate, struct nfsd4_locku *locku)
{
- get_stateid(cstate, &close->cl_stateid);
+ get_stateid(cstate, &locku->lu_stateid);
}
--
1.7.7.5
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATH v5 4/8] nfsd41: consume current stateid on read and write
2012-01-06 9:45 [PATH v5 0/8] process current stateid Tigran Mkrtchyan
` (2 preceding siblings ...)
2012-01-06 9:45 ` [PATH v5 3/8] nfsd41: handle current stateid on lock and locku Tigran Mkrtchyan
@ 2012-01-06 9:45 ` Tigran Mkrtchyan
2012-01-06 9:45 ` [PATH v5 5/8] nfsd41: mark PUTFH, PUTPUBFH and PUTROOTFH to clear current stateid Tigran Mkrtchyan
` (4 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Tigran Mkrtchyan @ 2012-01-06 9:45 UTC (permalink / raw)
To: linux-nfs; +Cc: Tigran Mkrtchyan
From: Tigran Mkrtchyan <kofemann@gmail.com>
Signed-off-by: Tigran Mkrtchyan <kofemann@gmail.com>
---
fs/nfsd/current_stateid.h | 2 ++
fs/nfsd/nfs4proc.c | 2 ++
fs/nfsd/nfs4state.c | 12 ++++++++++++
3 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/fs/nfsd/current_stateid.h b/fs/nfsd/current_stateid.h
index 21550b6..6e54d19 100644
--- a/fs/nfsd/current_stateid.h
+++ b/fs/nfsd/current_stateid.h
@@ -16,5 +16,7 @@ extern void nfsd4_set_closestateid(struct nfsd4_compound_state *, struct nfsd4_c
*/
extern void nfsd4_get_closestateid(struct nfsd4_compound_state *, struct nfsd4_close *);
extern void nfsd4_get_lockustateid(struct nfsd4_compound_state *, struct nfsd4_locku *);
+extern void nfsd4_get_readstateid(struct nfsd4_compound_state *, struct nfsd4_read *);
+extern void nfsd4_get_writestateid(struct nfsd4_compound_state *, struct nfsd4_write *);
#endif /* _NFSD4_CURRENT_STATE_H */
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 3e7b97f..20c8d24 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -1864,6 +1864,7 @@ static struct nfsd4_operation nfsd4_ops[] = {
.op_flags = OP_MODIFIES_SOMETHING,
.op_name = "OP_READ",
.op_rsize_bop = (nfsd4op_rsize)nfsd4_read_rsize,
+ .op_get_currentstateid = (stateid_getter)nfsd4_get_readstateid,
},
[OP_READDIR] = {
.op_func = (nfsd4op_func)nfsd4_readdir,
@@ -1942,6 +1943,7 @@ static struct nfsd4_operation nfsd4_ops[] = {
.op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,
.op_name = "OP_WRITE",
.op_rsize_bop = (nfsd4op_rsize)nfsd4_write_rsize,
+ .op_get_currentstateid = (stateid_getter)nfsd4_get_writestateid,
},
[OP_RELEASE_LOCKOWNER] = {
.op_func = (nfsd4op_func)nfsd4_release_lockowner,
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 5add33f8..cf9bc80 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -4757,3 +4757,15 @@ nfsd4_get_lockustateid(struct nfsd4_compound_state *cstate, struct nfsd4_locku *
{
get_stateid(cstate, &locku->lu_stateid);
}
+
+void
+nfsd4_get_readstateid(struct nfsd4_compound_state *cstate, struct nfsd4_read *read)
+{
+ get_stateid(cstate, &read->rd_stateid);
+}
+
+void
+nfsd4_get_writestateid(struct nfsd4_compound_state *cstate, struct nfsd4_write *write)
+{
+ get_stateid(cstate, &write->wr_stateid);
+}
--
1.7.7.5
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATH v5 5/8] nfsd41: mark PUTFH, PUTPUBFH and PUTROOTFH to clear current stateid
2012-01-06 9:45 [PATH v5 0/8] process current stateid Tigran Mkrtchyan
` (3 preceding siblings ...)
2012-01-06 9:45 ` [PATH v5 4/8] nfsd41: consume current stateid on read and write Tigran Mkrtchyan
@ 2012-01-06 9:45 ` Tigran Mkrtchyan
2012-01-06 9:45 ` [PATH v5 6/8] nfsd41: save and restore current stateid with current fh Tigran Mkrtchyan
` (3 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Tigran Mkrtchyan @ 2012-01-06 9:45 UTC (permalink / raw)
To: linux-nfs; +Cc: Tigran Mkrtchyan
From: Tigran Mkrtchyan <kofemann@gmail.com>
Signed-off-by: Tigran Mkrtchyan <kofemann@gmail.com>
---
fs/nfsd/nfs4proc.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 20c8d24..76b96a2 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -1841,21 +1841,24 @@ static struct nfsd4_operation nfsd4_ops[] = {
[OP_PUTFH] = {
.op_func = (nfsd4op_func)nfsd4_putfh,
.op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS
- | OP_IS_PUTFH_LIKE | OP_MODIFIES_SOMETHING,
+ | OP_IS_PUTFH_LIKE | OP_MODIFIES_SOMETHING
+ | OP_CLEAR_STATEID,
.op_name = "OP_PUTFH",
.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,
},
[OP_PUTPUBFH] = {
.op_func = (nfsd4op_func)nfsd4_putrootfh,
.op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS
- | OP_IS_PUTFH_LIKE | OP_MODIFIES_SOMETHING,
+ | OP_IS_PUTFH_LIKE | OP_MODIFIES_SOMETHING
+ | OP_CLEAR_STATEID,
.op_name = "OP_PUTPUBFH",
.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,
},
[OP_PUTROOTFH] = {
.op_func = (nfsd4op_func)nfsd4_putrootfh,
.op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS
- | OP_IS_PUTFH_LIKE | OP_MODIFIES_SOMETHING,
+ | OP_IS_PUTFH_LIKE | OP_MODIFIES_SOMETHING
+ | OP_CLEAR_STATEID,
.op_name = "OP_PUTROOTFH",
.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,
},
--
1.7.7.5
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATH v5 6/8] nfsd41: save and restore current stateid with current fh
2012-01-06 9:45 [PATH v5 0/8] process current stateid Tigran Mkrtchyan
` (4 preceding siblings ...)
2012-01-06 9:45 ` [PATH v5 5/8] nfsd41: mark PUTFH, PUTPUBFH and PUTROOTFH to clear current stateid Tigran Mkrtchyan
@ 2012-01-06 9:45 ` Tigran Mkrtchyan
2012-01-06 9:45 ` [PATH v5 7/8] nfsd41: mark LOOKUP, LOOKUPP and CREATE to invalidate current stateid Tigran Mkrtchyan
` (2 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Tigran Mkrtchyan @ 2012-01-06 9:45 UTC (permalink / raw)
To: linux-nfs; +Cc: Tigran Mkrtchyan
From: Tigran Mkrtchyan <kofemann@gmail.com>
Signed-off-by: Tigran Mkrtchyan <kofemann@gmail.com>
---
fs/nfsd/nfs4proc.c | 2 ++
fs/nfsd/xdr4.h | 1 +
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 76b96a2..4b32672 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -454,6 +454,7 @@ nfsd4_restorefh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
return nfserr_restorefh;
fh_dup2(&cstate->current_fh, &cstate->save_fh);
+ cstate->current_stateid = cstate->save_stateid;
return nfs_ok;
}
@@ -465,6 +466,7 @@ nfsd4_savefh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
return nfserr_nofilehandle;
fh_dup2(&cstate->save_fh, &cstate->current_fh);
+ cstate->save_stateid = cstate->current_stateid;
return nfs_ok;
}
diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h
index 7ec4e4f..a86d24d8 100644
--- a/fs/nfsd/xdr4.h
+++ b/fs/nfsd/xdr4.h
@@ -57,6 +57,7 @@ struct nfsd4_compound_state {
u32 minorversion;
u32 status;
const stateid_t *current_stateid;
+ const stateid_t *save_stateid;
};
static inline bool nfsd4_has_session(struct nfsd4_compound_state *cs)
--
1.7.7.5
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATH v5 7/8] nfsd41: mark LOOKUP, LOOKUPP and CREATE to invalidate current stateid
2012-01-06 9:45 [PATH v5 0/8] process current stateid Tigran Mkrtchyan
` (5 preceding siblings ...)
2012-01-06 9:45 ` [PATH v5 6/8] nfsd41: save and restore current stateid with current fh Tigran Mkrtchyan
@ 2012-01-06 9:45 ` Tigran Mkrtchyan
2012-01-06 9:45 ` [PATH v5 8/8] nfsv41: handle current stateid on LAYOUTGET Tigran Mkrtchyan
2012-01-09 22:56 ` [PATH v5 0/8] process current stateid J. Bruce Fields
8 siblings, 0 replies; 11+ messages in thread
From: Tigran Mkrtchyan @ 2012-01-06 9:45 UTC (permalink / raw)
To: linux-nfs; +Cc: Tigran Mkrtchyan
From: Tigran Mkrtchyan <kofemann@gmail.com>
Signed-off-by: Tigran Mkrtchyan <kofemann@gmail.com>
---
fs/nfsd/nfs4proc.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 4b32672..8ee49d8 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -1763,7 +1763,7 @@ static struct nfsd4_operation nfsd4_ops[] = {
},
[OP_CREATE] = {
.op_func = (nfsd4op_func)nfsd4_create,
- .op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,
+ .op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME | OP_CLEAR_STATEID,
.op_name = "OP_CREATE",
.op_rsize_bop = (nfsd4op_rsize)nfsd4_create_rsize,
},
@@ -1809,12 +1809,12 @@ static struct nfsd4_operation nfsd4_ops[] = {
},
[OP_LOOKUP] = {
.op_func = (nfsd4op_func)nfsd4_lookup,
- .op_flags = OP_HANDLES_WRONGSEC,
+ .op_flags = OP_HANDLES_WRONGSEC | OP_CLEAR_STATEID,
.op_name = "OP_LOOKUP",
},
[OP_LOOKUPP] = {
.op_func = (nfsd4op_func)nfsd4_lookupp,
- .op_flags = OP_HANDLES_WRONGSEC,
+ .op_flags = OP_HANDLES_WRONGSEC | OP_CLEAR_STATEID,
.op_name = "OP_LOOKUPP",
},
[OP_NVERIFY] = {
--
1.7.7.5
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATH v5 8/8] nfsv41: handle current stateid on LAYOUTGET
2012-01-06 9:45 [PATH v5 0/8] process current stateid Tigran Mkrtchyan
` (6 preceding siblings ...)
2012-01-06 9:45 ` [PATH v5 7/8] nfsd41: mark LOOKUP, LOOKUPP and CREATE to invalidate current stateid Tigran Mkrtchyan
@ 2012-01-06 9:45 ` Tigran Mkrtchyan
2012-01-09 22:56 ` [PATH v5 0/8] process current stateid J. Bruce Fields
8 siblings, 0 replies; 11+ messages in thread
From: Tigran Mkrtchyan @ 2012-01-06 9:45 UTC (permalink / raw)
To: linux-nfs; +Cc: Tigran Mkrtchyan
From: Tigran Mkrtchyan <kofemann@gmail.com>
Signed-off-by: Tigran Mkrtchyan <kofemann@gmail.com>
---
fs/nfsd/current_stateid.h | 3 ++-
fs/nfsd/nfs4proc.c | 2 ++
fs/nfsd/nfs4state.c | 12 ++++++++++++
3 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/fs/nfsd/current_stateid.h b/fs/nfsd/current_stateid.h
index 6e54d19..9fc23c9 100644
--- a/fs/nfsd/current_stateid.h
+++ b/fs/nfsd/current_stateid.h
@@ -10,6 +10,7 @@
extern void nfsd4_set_openstateid(struct nfsd4_compound_state *, struct nfsd4_open *);
extern void nfsd4_set_lockstateid(struct nfsd4_compound_state *, struct nfsd4_lock *);
extern void nfsd4_set_closestateid(struct nfsd4_compound_state *, struct nfsd4_close *);
+extern void nfsd4_set_layoutgetstateid(struct nfsd4_compound_state *, struct nfsd4_pnfs_layoutget *);
/*
* functions to consume current state id
@@ -18,5 +19,5 @@ extern void nfsd4_get_closestateid(struct nfsd4_compound_state *, struct nfsd4_c
extern void nfsd4_get_lockustateid(struct nfsd4_compound_state *, struct nfsd4_locku *);
extern void nfsd4_get_readstateid(struct nfsd4_compound_state *, struct nfsd4_read *);
extern void nfsd4_get_writestateid(struct nfsd4_compound_state *, struct nfsd4_write *);
-
+extern void nfsd4_get_layoutgetstateid(struct nfsd4_compound_state *, struct nfsd4_pnfs_layoutget *);
#endif /* _NFSD4_CURRENT_STATE_H */
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 8ee49d8..f227f71 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -2034,6 +2034,8 @@ static struct nfsd4_operation nfsd4_ops[] = {
[OP_LAYOUTGET] = {
.op_func = (nfsd4op_func)nfsd4_layoutget,
.op_name = "OP_LAYOUTGET",
+ .op_get_currentstateid = (stateid_getter)nfsd4_get_layoutgetstateid,
+ .op_set_currentstateid = (stateid_setter)nfsd4_set_layoutgetstateid,
},
[OP_LAYOUTCOMMIT] = {
.op_func = (nfsd4op_func)nfsd4_layoutcommit,
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index cf9bc80..000cae7 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -4743,6 +4743,12 @@ nfsd4_set_lockstateid(struct nfsd4_compound_state *cstate, struct nfsd4_lock *lo
put_stateid(cstate, &lock->lk_resp_stateid);
}
+void
+nfsd4_set_layoutgetstateid(struct nfsd4_compound_state *cstate, struct nfsd4_pnfs_layoutget *lgp)
+{
+ put_stateid(cstate, &lgp->lg_sid);
+}
+
/*
* functions to consume current state id
*/
@@ -4769,3 +4775,9 @@ nfsd4_get_writestateid(struct nfsd4_compound_state *cstate, struct nfsd4_write *
{
get_stateid(cstate, &write->wr_stateid);
}
+
+void
+nfsd4_get_layoutgetstateid(struct nfsd4_compound_state *cstate, struct nfsd4_pnfs_layoutget *lgp)
+{
+ get_stateid(cstate, &lgp->lg_sid);
+}
--
1.7.7.5
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATH v5 0/8] process current stateid
2012-01-06 9:45 [PATH v5 0/8] process current stateid Tigran Mkrtchyan
` (7 preceding siblings ...)
2012-01-06 9:45 ` [PATH v5 8/8] nfsv41: handle current stateid on LAYOUTGET Tigran Mkrtchyan
@ 2012-01-09 22:56 ` J. Bruce Fields
2012-01-10 21:54 ` Tiramisu Mokka
8 siblings, 1 reply; 11+ messages in thread
From: J. Bruce Fields @ 2012-01-09 22:56 UTC (permalink / raw)
To: Tigran Mkrtchyan; +Cc: linux-nfs, Tigran Mkrtchyan
On Fri, Jan 06, 2012 at 10:45:08AM +0100, Tigran Mkrtchyan wrote:
> From: Tigran Mkrtchyan <kofemann@gmail.com>
>
> Yet another update (v5) of current stateid handling
>
> re-based to Benny's git branch pnfs-all-latest ( to include PNFS operations )
>
> Includes a patch from Bruce f32f3c2d3f09a586349ca9180885dc8741290fd9
>
> I have tested:
>
> OPEN+READ+CLOSE
> OPEN+WRITE+CLOSE
> OPEN+LOCK+WRITE+LOCKU+CLOSE
> OPEN+PUTROOTFH+CLOSE
Thanks, Tigran!
How far are we from being done? I think some more operations still need
handling (as in e.g.
http://article.gmane.org/gmane.linux.nfs/45593/match=current+stateid
).
I don't think we have to have pynfs tests for every single of of those,
as they're mostly pretty similar.
When it's ready to be merged, I'd like it rebased on my tree
(git://linux-nfs.org/~bfields/linux.git, for-next branch is fine),
without any of the pNFS bits initially.
--b.
>
>
> implemented but not tested
> OPEN+LAYOUTGET
>
> Tigran.
>
> Tigran Mkrtchyan (8):
> nfsd4: initialize special stateid's at compile time
> nfsd41: handle current stateid in open and close
> nfsd41: handle current stateid on lock and locku
> nfsd41: consume current stateid on read and write
> nfsd41: mark PUTFH, PUTPUBFH and PUTROOTFH to clear current stateid
> nfsd41: save and restore current stateid with current fh
> nfsd41: mark LOOKUP, LOOKUPP and CREATE to invalidate current stateid
> nfsv41: handle current stateid on LAYOUTGET
>
> fs/nfsd/current_stateid.h | 23 +++++++++++
> fs/nfsd/nfs4proc.c | 53 ++++++++++++++++++++-----
> fs/nfsd/nfs4state.c | 95 ++++++++++++++++++++++++++++++++++++++++++--
> fs/nfsd/xdr4.h | 2 +
> 4 files changed, 158 insertions(+), 15 deletions(-)
> create mode 100644 fs/nfsd/current_stateid.h
>
> --
> 1.7.7.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATH v5 0/8] process current stateid
2012-01-09 22:56 ` [PATH v5 0/8] process current stateid J. Bruce Fields
@ 2012-01-10 21:54 ` Tiramisu Mokka
0 siblings, 0 replies; 11+ messages in thread
From: Tiramisu Mokka @ 2012-01-10 21:54 UTC (permalink / raw)
To: J. Bruce Fields; +Cc: linux-nfs, Tigran Mkrtchyan
On Mon, Jan 9, 2012 at 23:56, J. Bruce Fields <bfields@fieldses.org> wrote:
> On Fri, Jan 06, 2012 at 10:45:08AM +0100, Tigran Mkrtchyan wrote:
>> From: Tigran Mkrtchyan <kofemann@gmail.com>
>>
>> Yet another update (v5) of current stateid handling
>>
>> re-based to Benny's git branch pnfs-all-latest ( to include PNFS operations )
>>
>> Includes a patch from Bruce f32f3c2d3f09a586349ca9180885dc8741290fd9
>>
>> I have tested:
>>
>> OPEN+READ+CLOSE
>> OPEN+WRITE+CLOSE
>> OPEN+LOCK+WRITE+LOCKU+CLOSE
>> OPEN+PUTROOTFH+CLOSE
>
> Thanks, Tigran!
>
> How far are we from being done? I think some more operations still need
> handling (as in e.g.
>
> http://article.gmane.org/gmane.linux.nfs/45593/match=current+stateid
>
> ).
well, there is not that much left. I hope to finish till end of this
or next week.
Testing is the slowest part.
Tigran.
>
> I don't think we have to have pynfs tests for every single of of those,
> as they're mostly pretty similar.
>
> When it's ready to be merged, I'd like it rebased on my tree
> (git://linux-nfs.org/~bfields/linux.git, for-next branch is fine),
> without any of the pNFS bits initially.
>
> --b.
>
>
>>
>>
>> implemented but not tested
>> OPEN+LAYOUTGET
>>
>> Tigran.
>>
>> Tigran Mkrtchyan (8):
>> nfsd4: initialize special stateid's at compile time
>> nfsd41: handle current stateid in open and close
>> nfsd41: handle current stateid on lock and locku
>> nfsd41: consume current stateid on read and write
>> nfsd41: mark PUTFH, PUTPUBFH and PUTROOTFH to clear current stateid
>> nfsd41: save and restore current stateid with current fh
>> nfsd41: mark LOOKUP, LOOKUPP and CREATE to invalidate current stateid
>> nfsv41: handle current stateid on LAYOUTGET
>>
>> fs/nfsd/current_stateid.h | 23 +++++++++++
>> fs/nfsd/nfs4proc.c | 53 ++++++++++++++++++++-----
>> fs/nfsd/nfs4state.c | 95 ++++++++++++++++++++++++++++++++++++++++++--
>> fs/nfsd/xdr4.h | 2 +
>> 4 files changed, 158 insertions(+), 15 deletions(-)
>> create mode 100644 fs/nfsd/current_stateid.h
>>
>> --
>> 1.7.7.5
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2012-01-10 21:54 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-06 9:45 [PATH v5 0/8] process current stateid Tigran Mkrtchyan
2012-01-06 9:45 ` [PATH v5 1/8] nfsd4: initialize special stateid's at compile time Tigran Mkrtchyan
2012-01-06 9:45 ` [PATH v5 2/8] nfsd41: handle current stateid in open and close Tigran Mkrtchyan
2012-01-06 9:45 ` [PATH v5 3/8] nfsd41: handle current stateid on lock and locku Tigran Mkrtchyan
2012-01-06 9:45 ` [PATH v5 4/8] nfsd41: consume current stateid on read and write Tigran Mkrtchyan
2012-01-06 9:45 ` [PATH v5 5/8] nfsd41: mark PUTFH, PUTPUBFH and PUTROOTFH to clear current stateid Tigran Mkrtchyan
2012-01-06 9:45 ` [PATH v5 6/8] nfsd41: save and restore current stateid with current fh Tigran Mkrtchyan
2012-01-06 9:45 ` [PATH v5 7/8] nfsd41: mark LOOKUP, LOOKUPP and CREATE to invalidate current stateid Tigran Mkrtchyan
2012-01-06 9:45 ` [PATH v5 8/8] nfsv41: handle current stateid on LAYOUTGET Tigran Mkrtchyan
2012-01-09 22:56 ` [PATH v5 0/8] process current stateid J. Bruce Fields
2012-01-10 21:54 ` Tiramisu Mokka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).