[Patch] scsi_ioctl: support persistent reserve commands through ioctl for non-root user.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



scsi_ioctl: support persistent reserve commands through ioctl for
non-root user.

Scsi persistent reserve commands need to be used for non-root user in
many scenarios.
EPERM error will be returned by sg_io() when PERSISTENT_RESERVE_OUT
or PERSISTENT_RESERVE_IN command is sent through ioctl() for
non-root user.
Add PERSISTENT_RESERVE_OUT and PERSISTENT_RESERVE_IN into
blk_default_cmd_filter in blk_set_cmd_filter_defaults() to support 
persistent reserve commands for non-root user.

Signed-off-by: Jiang Biao <jiang.biao2@xxxxxxxxxx>
Signed-off-by: Li Ping <li.ping288@xxxxxxxxxx>
Reviewed-by: Liu Jianjun <liu.jianjun3@xxxxxxxxxx>

diff -urpN block/scsi_ioctl.c block_new/scsi_ioctl.c
--- block/scsi_ioctl.c  2015-08-01 17:07:47.000000000 +0800
+++ block_new/scsi_ioctl.c      2015-08-01 17:09:56.000000000 +0800
@@ -202,6 +202,9 @@ static void blk_set_cmd_filter_defaults(
        __set_bit(GPCMD_LOAD_UNLOAD, filter->write_ok);
        __set_bit(GPCMD_SET_STREAMING, filter->write_ok);
        __set_bit(GPCMD_SET_READ_AHEAD, filter->write_ok);
+       /* Persistent reserve command*/
+       __set_bit(PERSISTENT_RESERVE_IN, filter->read_ok);
+       __set_bit(PERSISTENT_RESERVE_OUT, filter->write_ok);
 }

 int blk_verify_command(unsigned char *cmd, fmode_t has_write_perm)
��.n��������+%������w��{.n�����{������ܨ}���Ơz�j:+v�����w����ޙ��&�)ߡ�a����z�ޗ���ݢj��w�f




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux