[stgt] [PATCH 2/2] fix a bug in checking of bsoflags user string
Alexander Nezhinsky
alexandern at mellanox.com
Thu Nov 10 14:55:44 CET 2011
Matching of the user-supplied bsoflags string against the flags supported by a backing store
should test if all user-supplied flags are supported, and not that at least one of them
is supported.
Signed-off-by: Alexander Nezhinsky <alexandern at mellanox.com>
---
usr/target.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/usr/target.c b/usr/target.c
index 1a7f355..dd4b358 100644
--- a/usr/target.c
+++ b/usr/target.c
@@ -450,6 +450,7 @@ int tgt_device_create(int tid, int dev_type, uint64_t lun, char *params,
struct backingstore_template *bst;
struct it_nexus_lu_info *itn_lu;
struct it_nexus *itn;
+ char strflags[128];
dprintf("%d %" PRIu64 "\n", tid, lun);
@@ -518,8 +519,11 @@ int tgt_device_create(int tid, int dev_type, uint64_t lun, char *params,
}
}
- if (lu_bsoflags && !(bst->bs_oflags_supported & lu_bsoflags)) {
- eprintf("bsoflags not supported\n");
+ if (lu_bsoflags && ((bst->bs_oflags_supported & lu_bsoflags) != lu_bsoflags)) {
+ eprintf("bsoflags %s not supported by backing store %s\n",
+ open_flags_to_str(strflags,
+ (bst->bs_oflags_supported & lu_bsoflags) ^ lu_bsoflags),
+ bst->bs_name);
ret = TGTADM_INVALID_REQUEST;
goto out;
}
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
More information about the stgt
mailing list