[Pvfs2-developers] read-only mounts
Sam Lang
slang at mcs.anl.gov
Tue Feb 19 17:15:59 EST 2008
On Feb 19, 2008, at 3:54 PM, Pete Wyckoff wrote:
> carns at mcs.anl.gov wrote on Tue, 19 Feb 2008 14:57 -0500:
>> You wouldn't have to add read-only export capability- its already
>> there :)
>>
>> Have a look at the "ReadOnly" option and comments that go with it in
>> src/common/misc/server-config.c. I've used it (and the associated
>> squashing options) a little bit and it seems to work fine. Would
>> this work
>> for what you need?
>
> That's awesome. I should have known there would be something like
> this.
>
> It's a bit of an overachiever though. I can't readdir. In fact I
> could manage a write, however, if the getattr could be faked around.
> Looks like there were some issues with 0/1 in these functions. Not
> sure if this appeared in the server request cleanup or if it was
> already there.
Yep, that could be from the cleanups I made. Sorry about that.
>
>
> Can you (all) look this over and make sure it is reasonable? Keep
> in mind that the enum for PINT_SERVER_REQ_READONLY has value 0, and
> _MODIFY is 1. There's a change in prelude.sm, grep for
> PINT_SERVER_CHECK_NONE, that I'm a bit unsure about.
>
> -- Pete
>
>
> readonly symbolic
>
> Change access_type functions from 0/1 to use the enum
> PINT_server_req_access_type. There may have been some backward
> conditionals in here. This at least makes them all visible,
> and fixes a problem with ReadOnly exports where only reads
> (but not writes) were forbidden.
> ---
> src/server/io.sm | 6 +++---
> src/server/prelude.sm | 13 +++++++++----
> src/server/pvfs2-server-req.c | 10 ++++++----
> src/server/pvfs2-server.h | 11 ++++++-----
> src/server/small-io.sm | 6 +++---
> 5 files changed, 27 insertions(+), 19 deletions(-)
>
> diff --git a/src/server/io.sm b/src/server/io.sm
> index c82d19f..064cf6b 100644
> --- a/src/server/io.sm
> +++ b/src/server/io.sm
> @@ -379,14 +379,14 @@ static PINT_sm_action io_send_completion_ack(
> return err;
> }
>
> -static inline int PINT_server_req_access_io(
> +static enum PINT_server_req_access_type PINT_server_req_access_io(
> struct PVFS_server_req *req)
> {
> if(req->u.io.io_type == PVFS_IO_READ)
> {
> - return 1;
> + return PINT_SERVER_REQ_READONLY;
> }
> - return 0;
> + return PINT_SERVER_REQ_MODIFY;
> }
>
> PINT_GET_OBJECT_REF_DEFINE(io);
> diff --git a/src/server/prelude.sm b/src/server/prelude.sm
> index b6662b6..a04c7bd 100644
> --- a/src/server/prelude.sm
> +++ b/src/server/prelude.sm
> @@ -289,15 +289,20 @@ static int iterate_ro_wildcards(struct
> filesystem_configuration_s *fsconfig, PVF
> return 0;
> }
>
> -static int permit_operation(PVFS_fs_id fsid, int read_only,
> PVFS_BMI_addr_t client_addr)
> +/*
> + * Return zero if this operation should be allowed.
> + */
> +static int permit_operation(PVFS_fs_id fsid,
> + enum PINT_server_req_access_type
> access_type,
> + PVFS_BMI_addr_t client_addr)
> {
> int exp_flags = 0;
> struct server_configuration_s *serv_config = NULL;
> struct filesystem_configuration_s * fsconfig = NULL;
>
> - if (read_only == 1)
> + if (access_type == PINT_SERVER_REQ_READONLY)
> {
> - return 0;
> + return 0; /* anything that doesn't modify state is okay */
> }
> serv_config = PINT_get_server_config();
> fsconfig = PINT_config_find_fs_id(serv_config, fsid);
> @@ -480,7 +485,7 @@ static PINT_sm_action prelude_perm_check(
> break;
> case PINT_SERVER_CHECK_NONE:
> if(squashed_flag &&
> - !PINT_server_req_get_access_type(s_op->req) &&
> + PINT_server_req_get_access_type(s_op->req) ==
> PINT_SERVER_REQ_MODIFY &&
Yes, I think that's right. If its squashed, and its not read-only,
then return EACCES. The real question is whether all the converted
structs have the proper access types. They all look ok though.
> ((s_op->req->op == PVFS_SERV_IO) ||
> (s_op->req->op == PVFS_SERV_SMALL_IO) ||
> (s_op->req->op == PVFS_SERV_TRUNCATE)))
> diff --git a/src/server/pvfs2-server-req.c b/src/server/pvfs2-server-
> req.c
> index f5051fa..60fa4c5 100644
> --- a/src/server/pvfs2-server-req.c
> +++ b/src/server/pvfs2-server-req.c
> @@ -86,14 +86,16 @@ struct PINT_server_req_entry
> PINT_server_req_table[] =
>
> #define CHECK_OP(_op_) assert(_op_ ==
> PINT_server_req_table[_op_].op_type)
>
> -inline int PINT_server_req_readonly(struct PVFS_server_req *req)
> +enum PINT_server_req_access_type PINT_server_req_readonly(
> + struct PVFS_server_req *req)
> {
> - return 1;
> + return PINT_SERVER_REQ_READONLY;
> }
>
> -inline int PINT_server_req_modify(struct PVFS_server_req *req)
> +enum PINT_server_req_access_type PINT_server_req_modify(
> + struct PVFS_server_req *req)
> {
> - return 0;
> + return PINT_SERVER_REQ_MODIFY;
> }
>
> enum PINT_server_req_permissions
> diff --git a/src/server/pvfs2-server.h b/src/server/pvfs2-server.h
> index 90769be..6bfd0ba 100644
> --- a/src/server/pvfs2-server.h
> +++ b/src/server/pvfs2-server.h
> @@ -97,10 +97,10 @@ static inline int
> PINT_get_object_ref_##req_name( \
> return
> 0; \
> }
>
> -typedef int (*PINT_server_req_access_callback)(struct
> PVFS_server_req *req);
> -
> -int PINT_server_req_readonly(struct PVFS_server_req *req);
> -int PINT_server_req_modify(struct PVFS_server_req *req);
> +enum PINT_server_req_access_type PINT_server_req_readonly(
> + struct PVFS_server_req *req);
> +enum PINT_server_req_access_type PINT_server_req_modify(
> + struct PVFS_server_req *req);
There might be an issue with returning those enums, because they're
not defined everywhere. I remember having to change them back to ints
to try to get the test code to build, but then I just commented out
some of the tests because of more complicated linkage problems. You
might try compiling the tests to make sure, otherwise I'm cool with
this change.
-sam
>
>
> struct PINT_server_req_params
> {
> @@ -121,7 +121,8 @@ struct PINT_server_req_params
> * Default functions PINT_server_req_readonly and
> PINT_server_req_modify
> * are used for requests that always require the same access type.
> */
> - PINT_server_req_access_callback access_type;
> + enum PINT_server_req_access_type (*access_type)(
> + struct PVFS_server_req *req);
>
> /* Specifies the scheduling policy for the request. In some
> cases,
> * we can bypass the request scheduler and proceed directly with
> the
> diff --git a/src/server/small-io.sm b/src/server/small-io.sm
> index 38b78c7..3793866 100644
> --- a/src/server/small-io.sm
> +++ b/src/server/small-io.sm
> @@ -241,14 +241,14 @@ static PINT_sm_action small_io_cleanup(
> return server_state_machine_complete(smcb);
> }
>
> -static inline int PINT_server_req_access_small_io(
> +static inline enum PINT_server_req_access_type
> PINT_server_req_access_small_io(
> struct PVFS_server_req *req)
> {
> if(req->u.io.io_type == PVFS_IO_READ)
> {
> - return 1;
> + return PINT_SERVER_REQ_READONLY;
> }
> - return 0;
> + return PINT_SERVER_REQ_MODIFY;
> }
>
> PINT_GET_OBJECT_REF_DEFINE(small_io);
> --
> 1.5.4.1
>
> _______________________________________________
> Pvfs2-developers mailing list
> Pvfs2-developers at beowulf-underground.org
> http://www.beowulf-underground.org/mailman/listinfo/pvfs2-developers
>
More information about the Pvfs2-developers
mailing list