Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sed-opal: add IOC_OPAL_LR_SET_START_LEN ioctl.

This ioctl is used to set up locking range start (offset)
and locking range length attributes only.

In Single User Mode (SUM), if the RangeStartRangeLengthPolicy parameter
is set in the 'Reactivate' method, only Admin authority maintains the
locking range length and start (offset) attributes of Locking objects
set up for SUM. All other attributes from struct opal_user_lr_setup
(RLE - read locking enabled, WLE - write locking enabled) shall
remain in possession of the User authority associated with the Locking
object set for SUM.

Therefore, we need a separate function for setting up locking range
start and locking range length because it may require two different
authorities (and sessions) if the RangeStartRangeLengthPolicy attribute
is set.

With the IOC_OPAL_LR_SET_START_LEN ioctl, the opal_user_lr_setup
members 'RLE' and 'WLE' of the ioctl argument are ignored.

Signed-off-by: Ondrej Kozina <okozina@redhat.com>
Reviewed-and-tested-by: Milan Broz <gmazyland@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Ondrej Kozina and committed by
Jens Axboe
8e3d34a7 8ff71e6b

+30
+28
block/sed-opal.c
··· 3091 3091 return ret; 3092 3092 } 3093 3093 3094 + static int opal_setup_locking_range_start_length(struct opal_dev *dev, 3095 + struct opal_user_lr_setup *opal_lrs) 3096 + { 3097 + const struct opal_step lr_steps[] = { 3098 + { start_auth_opal_session, &opal_lrs->session }, 3099 + { setup_locking_range_start_length, opal_lrs }, 3100 + { end_opal_session, } 3101 + }; 3102 + int ret; 3103 + 3104 + /* we can not set global locking range offset or length */ 3105 + if (opal_lrs->session.opal_key.lr == 0) 3106 + return -EINVAL; 3107 + 3108 + ret = opal_get_key(dev, &opal_lrs->session.opal_key); 3109 + if (ret) 3110 + return ret; 3111 + mutex_lock(&dev->dev_lock); 3112 + setup_opal_dev(dev); 3113 + ret = execute_steps(dev, lr_steps, ARRAY_SIZE(lr_steps)); 3114 + mutex_unlock(&dev->dev_lock); 3115 + 3116 + return ret; 3117 + } 3118 + 3094 3119 static int opal_locking_range_status(struct opal_dev *dev, 3095 3120 struct opal_lr_status *opal_lrst, 3096 3121 void __user *data) ··· 3455 3430 break; 3456 3431 case IOC_OPAL_REACTIVATE_LSP: 3457 3432 ret = opal_reactivate_lsp(dev, p); 3433 + break; 3434 + case IOC_OPAL_LR_SET_START_LEN: 3435 + ret = opal_setup_locking_range_start_length(dev, p); 3458 3436 break; 3459 3437 3460 3438 default:
+1
include/linux/sed-opal.h
··· 54 54 case IOC_OPAL_REVERT_LSP: 55 55 case IOC_OPAL_SET_SID_PW: 56 56 case IOC_OPAL_REACTIVATE_LSP: 57 + case IOC_OPAL_LR_SET_START_LEN: 57 58 return true; 58 59 } 59 60 return false;
+1
include/uapi/linux/sed-opal.h
··· 230 230 #define IOC_OPAL_REVERT_LSP _IOW('p', 240, struct opal_revert_lsp) 231 231 #define IOC_OPAL_SET_SID_PW _IOW('p', 241, struct opal_new_pw) 232 232 #define IOC_OPAL_REACTIVATE_LSP _IOW('p', 242, struct opal_lr_react) 233 + #define IOC_OPAL_LR_SET_START_LEN _IOW('p', 243, struct opal_user_lr_setup) 233 234 234 235 #endif /* _UAPI_SED_OPAL_H */