Linux 3.16.7-ckt8 stable review
Subsystems (111)
PATCH 162/183 ipv6: mld: fix add_grhead skb_over_panic for devs with large MTUs
In reply to Luis Henriques3.16.7-ckt8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
commit 4c672e4b42bc8046d63a6eb0a2c6a450a501af32 upstream.
It has been reported that generating an MLD listener report on devices with large MTUs (e.g. 9000) and a high number of IPv6 addresses can trigger a skb_over_panic():
skbuff: skb_over_panic: text:ffffffff80612a5d len:3776 put:20 head:ffff88046d751000 data:ffff88046d751010 tail:0xed0 end:0xec0 dev:port1
------------[ cut here ]------------ kernel BUG at net/core/skbuff.c:100! invalid opcode: 0000 [#1] SMP Modules linked in: ixgbe(O) CPU: 3 PID: 0 Comm: swapper/3 Tainted: G O 3.14.23+ #4 [...] Call Trace: <IRQ> [<ffffffff80578226>] ? skb_put+0x3a/0x3b [<ffffffff80612a5d>] ? add_grhead+0x45/0x8e [<ffffffff80612e3a>] ? add_grec+0x394/0x3d4 [<ffffffff80613222>] ? mld_ifc_timer_expire+0x195/0x20d [<ffffffff8061308d>] ? mld_dad_timer_expire+0x45/0x45 [<ffffffff80255b5d>] ? call_timer_fn.isra.29+0x12/0x68 [<ffffffff80255d16>] ? run_timer_softirq+0x163/0x182 [<ffffffff80250e6f>] ? __do_softirq+0xe0/0x21d [<ffffffff8025112b>] ? irq_exit+0x4e/0xd3 [<ffffffff802214bb>] ? smp_apic_timer_interrupt+0x3b/0x46 [<ffffffff8063f10a>] ? apic_timer_interrupt+0x6a/0x70
mld_newpack() skb allocations are usually requested with dev->mtu in size, since commit 72e09ad107e7 ("ipv6: avoid high order allocations") we have changed the limit in order to be less likely to fail.
However, in MLD/IGMP code, we have some rather ugly AVAILABLE(skb) macros, which determine if we may end up doing an skb_put() for adding another record. To avoid possible fragmentation, we check the skb's tailroom as skb->dev->mtu - skb->len, which is a wrong assumption as the actual max allocation size can be much smaller.
The IGMP case doesn't have this issue as commit 57e1ab6eaddc ("igmp: refine skb allocations") stores the allocation size in the cb[].
Set a reserved_tailroom to make it fit into the MTU and use skb_availroom() helper instead. This also allows to get rid of igmp_skb_size().
--- net/ipv4/igmp.c | 11 +++++------ net/ipv6/mcast.c | 9 +++++---- 2 files changed, 10 insertions(+), 10 deletions(-)
net/ipv4/igmp.c +5 -6
@@ -318,9 +318,7 @@ igmp_scount(struct ip_mc_list *pmc, int type, int gdeleted, int sdeleted)return scount; } -#define igmp_skb_size (skb) (*(unsigned int *)((skb)->cb)) - -static struct sk_buff *igmpv3_newpack (struct net_device *dev,int size) +static struct sk_buff *igmpv3_newpack (struct net_device *dev,unsigned int mtu) {struct sk_buff *skb;struct rtable *rt;
@@ -330,6 +328,7 @@ static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size)struct flowi4 fl4;int hlen =LL_RESERVED_SPACE (dev);int tlen = dev->needed_tailroom; +unsigned int size = mtu;while (1 ) { skb = alloc_skb(size + hlen + tlen,
@@ -341,7 +340,6 @@ static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size)return NULL ; } skb->priority =TC_PRIO_CONTROL ; -igmp_skb_size (skb) = size; rt = ip_route_output_ports(net, &fl4, NULL, IGMPV3_ALL_MCR, 0, 0, 0,
@@ -354,6 +352,8 @@ static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size)skb_dst_set (skb, &rt->dst); skb->dev = dev; + skb->reserved_tailroom =skb_end_offset (skb) - +min (mtu,skb_end_offset (skb));skb_reserve (skb, hlen);skb_reset_network_header (skb);
@@ -423,8 +423,7 @@ static struct sk_buff *add_grhead(struct sk_buff *skb, struct ip_mc_list *pmc,return skb; } -#define AVAILABLE (skb) ((skb) ? ((skb)->dev ? igmp_skb_size(skb) - (skb)->len : \ - skb_tailroom(skb)) : 0) +#define AVAILABLE (skb) ((skb) ? skb_availroom(skb) : 0)static struct sk_buff *add_grec (struct sk_buff *skb,struct ip_mc_list *pmc,int type,int gdeleted,int sdeleted)
net/ipv6/mcast.c +5 -4
@@ -1545,7 +1545,7 @@ static void ip6_mc_hdr(struct sock *sk, struct sk_buff *skb, hdr->daddr = *daddr; } -static struct sk_buff *mld_newpack (struct inet6_dev *idev,int size) +static struct sk_buff *mld_newpack (struct inet6_dev *idev,unsigned int mtu) {struct net_device *dev = idev->dev;struct net *net =dev_net (dev);
@@ -1556,13 +1556,13 @@ static struct sk_buff *mld_newpack(struct inet6_dev *idev, int size)const struct in6_addr *saddr;int hlen =LL_RESERVED_SPACE (dev);int tlen = dev->needed_tailroom; +unsigned int size = mtu + hlen + tlen;int err;u8 ra[8 ] = {IPPROTO_ICMPV6 ,0 ,IPV6_TLV_ROUTERALERT ,2 ,0 ,0 ,IPV6_TLV_PADN ,0 };/* we assume size > sizeof(ra) here */ - size += hlen + tlen;/* limit our allocations to order-0 page */ size =min_t (int, size,SKB_MAX_ORDER (0 ,0 )); skb =sock_alloc_send_skb (sk, size,1 , &err);
@@ -1571,6 +1571,8 @@ static struct sk_buff *mld_newpack(struct inet6_dev *idev, int size)return NULL ; skb->priority =TC_PRIO_CONTROL ; + skb->reserved_tailroom =skb_end_offset (skb) - +min (mtu,skb_end_offset (skb));skb_reserve (skb, hlen);if (__ipv6_get_lladdr (idev, &addr_buf,IFA_F_TENTATIVE )) {
@@ -1685,8 +1687,7 @@ static struct sk_buff *add_grhead(struct sk_buff *skb, struct ifmcaddr6 *pmc,return skb; } -#define AVAILABLE (skb) ((skb) ? ((skb)->dev ? (skb)->dev->mtu - (skb)->len : \ - skb_tailroom(skb)) : 0) +#define AVAILABLE (skb) ((skb) ? skb_availroom(skb) : 0)static struct sk_buff *add_grec (struct sk_buff *skb,struct ifmcaddr6 *pmc,int type,int gdeleted,int sdeleted,int crsend)
PATCH 163/183 ideapad-laptop: Change Lenovo Yoga 2 series rfkill handling
In reply to Luis Henriques3.16.7-ckt8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit ce363c2bcb2303e7fad3a79398db739c6995141b upstream.
It seems that the same problems which lead to adding an rfkill blacklist and putting the Lenovo Yoga 2 11 on it are also present on the Lenovo Yoga 2 13 and Lenovo Yoga 2 Pro too:
https://bugzilla.redhat.com/show_bug.cgi?id=1021036
https://forums.lenovo.com/t5/Linux-Discussion/Yoga-2-13-not-Pro-Linux-Warning/m-p/1517612
Testing has shown that the firmware rfkill settings are persistent over reboots. So blacklisting the driver is not good enough, if the wifi is blocked at the firmware level the wifi needs to be explictly unblocked through the ideapad-laptop interface.
And at least on the Lenovo Yoga 2 13 the VPCCMD_RF register which on devices with hardware kill switch reports the hardware switch state, needs to be explictly set to 1 (radio enabled / not blocked).
So this patch does 3 things to get proper rfkill handling on these models:
1) Instead of blacklisting the rfkill functionality, which means that people with a firmware blocked wifi get stuck in that situation, ignore the value reported by the not present hardware rfkill switch, as this is what is causing ideapad-laptop to wrongly report all radios as hardware blocks. But do register the rfkill interfaces so that the user can soft [un]block them.
2) On models without a hardware rfkill switch, explictly set VPCCMD_RF to 1
3) Drop the " 11" postfix from the dmi match string, as the entire Yoga 2 series is affected.
Yoga 2 11:
Yoga 2 13:
Tested-by: madls05 <http://ubuntuforums.org/showthread.php?t=2215044>
Yoga 2 Pro:
--- drivers/platform/x86/ideapad-laptop.c | 41 +++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 14 deletions(-)
drivers/platform/x86/ideapad-laptop.c +27 -14
@@ -87,6 +87,7 @@ struct ideapad_private {struct backlight_device *blightdev;struct dentry *debug;unsigned long cfg; +bool has_hw_rfkill_switch; };static bool no_bt_rfkill;
@@ -473,12 +474,14 @@ static struct rfkill_ops ideapad_rfk_ops = {static void ideapad_sync_rfk_state (struct ideapad_private *priv) { -unsigned long hw_blocked; +unsigned long hw_blocked =0 ;int i; -if (read_ec_data (priv->adev->handle,VPCCMD_R_RF , &hw_blocked)) -return ; - hw_blocked = !hw_blocked; +if (priv->has_hw_rfkill_switch) { +if (read_ec_data (priv->adev->handle,VPCCMD_R_RF , &hw_blocked)) +return ; + hw_blocked = !hw_blocked; + }for (i =0 ; i <IDEAPAD_RFKILL_DEV_NUM ; i++)if (priv->rfk[i])
@@ -821,14 +824,17 @@ static void ideapad_acpi_notify(acpi_handle handle, u32 event, void *data) } } -/* Blacklist for devices where the ideapad rfkill interface does not work */ -static struct dmi_system_id rfkill_blacklist[] = { -/* The Lenovo Yoga 2 11 always reports everything as blocked */ +/* +* Some ideapads don't have a hardware rfkill switch, reading VPCCMD_R_RF +* always results in 0 on these models, causing ideapad_laptop to wrongly +* report all radios as hardware-blocked. +*/ +static struct dmi_system_id no_hw_rfkill_list[] = { { - .ident ="Lenovo Yoga 2 11" , + .ident ="Lenovo Yoga 2 11 / 13 / Pro" , .matches = {DMI_MATCH (DMI_SYS_VENDOR ,"LENOVO" ), -DMI_MATCH (DMI_PRODUCT_VERSION ,"Lenovo Yoga 2 11" ), +DMI_MATCH (DMI_PRODUCT_VERSION ,"Lenovo Yoga 2" ), }, }, {
@@ -863,6 +869,7 @@ static int ideapad_acpi_add(struct platform_device *pdev) priv->cfg = cfg; priv->adev = adev; priv->platform_device = pdev; + priv->has_hw_rfkill_switch = !dmi_check_system (no_hw_rfkill_list); ret =ideapad_sysfs_init (priv);if (ret)
@@ -876,11 +883,17 @@ static int ideapad_acpi_add(struct platform_device *pdev)if (ret) goto input_failed; -if (!dmi_check_system (rfkill_blacklist)) { -for (i =0 ; i <IDEAPAD_RFKILL_DEV_NUM ; i++) -if (test_bit (ideapad_rfk_data[i].cfgbit, &priv->cfg)) -ideapad_register_rfkill (priv, i); - } +/* +* On some models without a hw-switch (the yoga 2 13 at least) +* VPCCMD_W_RF must be explicitly set to 1 for the wifi to work. +*/ +if (!priv->has_hw_rfkill_switch) +write_ec_cmd (priv->adev->handle,VPCCMD_W_RF ,1 ); + +for (i =0 ; i <IDEAPAD_RFKILL_DEV_NUM ; i++) +if (test_bit (ideapad_rfk_data[i].cfgbit, &priv->cfg)) +ideapad_register_rfkill (priv, i); +ideapad_sync_rfk_state (priv);ideapad_sync_touchpad_state (priv);
PATCH 164/183 IB/core: When marshaling ucma path from user-space, clear unused fields
In reply to Luis Henriques3.16.7-ckt8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilya Nelkenbaum <[email protected]>
commit c2be9dc0e0fa59cc43c2c7084fc42b430809a0fe upstream.
When marshaling a user path to the kernel struct ib_sa_path, we need to zero smac and dmac and set the vlan id to the "no vlan" value.
This is to ensure that Ethernet attributes are not used with InfiniBand QPs.
--- drivers/infiniband/core/ucma.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/infiniband/core/ucma.c +3 -0
@@ -1124,6 +1124,9 @@ static int ucma_set_ib_path(struct ucma_context *ctx,if (!optlen)return -EINVAL ; +memset (&sa_path,0 ,sizeof (sa_path)); + sa_path.vlan_id =0xffff ; +ib_sa_unpack_path (path_data->path_rec, &sa_path); ret =rdma_set_ib_paths (ctx->cm_id, &sa_path,1 );if (ret)
PATCH 165/183 IB/core: Fix deadlock on uverbs modify_qp error flow
In reply to Luis Henriques3.16.7-ckt8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Moshe Lazer <[email protected]>
commit 0fb8bcf022f19a375d7c4bd79ac513da8ae6d78b upstream.
The deadlock occurs in __uverbs_modify_qp: we take a lock (idr_read_qp) and in case of failure in ib_resolve_eth_l2_attrs we don't release it (put_qp_read). Fix that.
--- drivers/infiniband/core/uverbs_cmd.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/infiniband/core/uverbs_cmd.c +5 -4
@@ -1964,20 +1964,21 @@ ssize_t ib_uverbs_modify_qp(struct ib_uverbs_file *file,if (qp->real_qp == qp) { ret =ib_resolve_eth_l2_attrs (qp, attr, &cmd.attr_mask);if (ret) - goto out; + goto release_qp; ret = qp->device->modify_qp (qp, attr,modify_qp_mask (qp->qp_type, cmd.attr_mask), &udata); }else { ret =ib_modify_qp (qp, attr,modify_qp_mask (qp->qp_type, cmd.attr_mask)); } -put_qp_read (qp); -if (ret) - goto out; + goto release_qp; ret = in_len; +release_qp: +put_qp_read (qp); + out:kfree (attr);
PATCH 166/183 IB/mlx4: Fix wrong usage of IPv4 protocol for multicast attach/detach
In reply to Luis Henriques3.16.7-ckt8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Or Gerlitz <[email protected]>
commit e9a7faf11af94957e5107b40af46c2e329541510 upstream.
The MLX4_PROT_IB_IPV4 protocol should only be used with RoCEv2 and such. Removing this wrong usage allows to run multicast applications over RoCE.
--- drivers/infiniband/hw/mlx4/main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/infiniband/hw/mlx4/main.c +5 -5
@@ -1170,8 +1170,7 @@ static int mlx4_ib_mcg_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)struct mlx4_ib_qp *mqp =to_mqp (ibqp);u64 reg_id;struct mlx4_ib_steering *ib_steering =NULL ; -enum mlx4_protocol prot = (gid->raw[1 ] ==0x0e ) ? -MLX4_PROT_IB_IPV4 :MLX4_PROT_IB_IPV6 ; +enum mlx4_protocol prot =MLX4_PROT_IB_IPV6 ;if (mdev->dev->caps.steering_mode ==MLX4_STEERING_MODE_DEVICE_MANAGED ) {
@@ -1184,8 +1183,10 @@ static int mlx4_ib_mcg_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) !!(mqp->flags &MLX4_IB_QP_BLOCK_MULTICAST_LOOPBACK ), prot, ®_id); -if (err) +if (err) { +pr_err ("multicast attach op failed, err %d\n" , err); goto err_malloc; + } err =add_gid_entry (ibqp, gid);if (err)
@@ -1233,8 +1234,7 @@ static int mlx4_ib_mcg_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)struct net_device *ndev;struct mlx4_ib_gid_entry *ge;u64 reg_id =0 ; -enum mlx4_protocol prot = (gid->raw[1 ] ==0x0e ) ? -MLX4_PROT_IB_IPV4 :MLX4_PROT_IB_IPV6 ; +enum mlx4_protocol prot =MLX4_PROT_IB_IPV6 ;if (mdev->dev->caps.steering_mode ==MLX4_STEERING_MODE_DEVICE_MANAGED ) {
PATCH 167/183 IB/iser: Use correct dma direction when unmapping SGs
In reply to Luis Henriques3.16.7-ckt8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Roi Dayan <[email protected]>
commit c6c95ef4cec680f7a10aa425a9970744b35b6489 upstream.
We always unmap SGs with the same direction instead of unmapping with the direction the mapping was done, fix that.
--- drivers/infiniband/ulp/iser/iscsi_iser.h | 4 +++- drivers/infiniband/ulp/iser/iser_initiator.c | 12 ++++++++---- drivers/infiniband/ulp/iser/iser_memory.c | 9 ++++++--- 3 files changed, 17 insertions(+), 8 deletions(-)
drivers/infiniband/ulp/iser/iscsi_iser.h +3 -1
@@ -471,7 +471,9 @@ int iser_dma_map_task_data(struct iscsi_iser_task *iser_task, enum dma_data_direction dma_dir);void iser_dma_unmap_task_data (struct iscsi_iser_task *iser_task, -struct iser_data_buf *data); +struct iser_data_buf *data, +enum dma_data_direction dir); +int iser_initialize_task_headers (struct iscsi_task *task,struct iser_tx_desc *tx_desc);int iser_alloc_rx_descriptors (struct iser_conn *ib_conn,struct iscsi_session *session);
drivers/infiniband/ulp/iser/iser_initiator.c +8 -4
@@ -702,19 +702,23 @@ void iser_task_rdma_finalize(struct iscsi_iser_task *iser_task) device->iser_unreg_rdma_mem (iser_task,ISER_DIR_IN );if (is_rdma_data_aligned)iser_dma_unmap_task_data (iser_task, - &iser_task->data[ISER_DIR_IN ]); + &iser_task->data[ISER_DIR_IN ], +DMA_FROM_DEVICE );if (prot_count && is_rdma_prot_aligned)iser_dma_unmap_task_data (iser_task, - &iser_task->prot[ISER_DIR_IN ]); + &iser_task->prot[ISER_DIR_IN ], +DMA_FROM_DEVICE ); }if (iser_task->dir[ISER_DIR_OUT ]) { device->iser_unreg_rdma_mem (iser_task,ISER_DIR_OUT );if (is_rdma_data_aligned)iser_dma_unmap_task_data (iser_task, - &iser_task->data[ISER_DIR_OUT ]); + &iser_task->data[ISER_DIR_OUT ], +DMA_TO_DEVICE );if (prot_count && is_rdma_prot_aligned)iser_dma_unmap_task_data (iser_task, - &iser_task->prot[ISER_DIR_OUT ]); + &iser_task->prot[ISER_DIR_OUT ], +DMA_TO_DEVICE ); } }
drivers/infiniband/ulp/iser/iser_memory.c +6 -3
@@ -333,12 +333,13 @@ int iser_dma_map_task_data(struct iscsi_iser_task *iser_task, }void iser_dma_unmap_task_data (struct iscsi_iser_task *iser_task, -struct iser_data_buf *data) +struct iser_data_buf *data, +enum dma_data_direction dir) {struct ib_device *dev; dev = iser_task->ib_conn->device->ib_device; -ib_dma_unmap_sg (dev, data->buf, data->size,DMA_FROM_DEVICE ); +ib_dma_unmap_sg (dev, data->buf, data->size, dir); } static int fall_to_bounce_buf(struct iscsi_iser_task *iser_task,
@@ -358,7 +359,9 @@ static int fall_to_bounce_buf(struct iscsi_iser_task *iser_task,iser_data_buf_dump (mem, ibdev);/* unmap the command data before accessing it */ -iser_dma_unmap_task_data (iser_task, mem); +iser_dma_unmap_task_data (iser_task, mem, + (cmd_dir ==ISER_DIR_OUT ) ? +DMA_TO_DEVICE :DMA_FROM_DEVICE );/* allocate copy buf, if we are writing, copy the */ /* unaligned scatterlist, dma map the copy */
PATCH 168/183 Si2168: increase timeout to fix firmware loading
In reply to Luis Henriques3.16.7-ckt8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Jurgen Kramer <[email protected]>
commit 551c33e729f654ecfaed00ad399f5d2a631b72cb upstream.
Increase si2168 cmd execute timeout to prevent firmware load failures. Tests shows it takes up to 52ms to load the 'dvb-demod-si2168-a30-01.fw' firmware. Increase timeout to a safe value of 70ms.
--- drivers/media/dvb-frontends/si2168.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/dvb-frontends/si2168.c +1 -1
@@ -39,7 +39,7 @@ static int si2168_cmd_execute(struct si2168 *s, struct si2168_cmd *cmd)if (cmd->rlen) {/* wait cmd execution terminate */ -#define TIMEOUT 50 +#define TIMEOUT 70 timeout = jiffies +msecs_to_jiffies (TIMEOUT );while (!time_after (jiffies, timeout)) { ret =i2c_master_recv (s->client, cmd->args, cmd->rlen);
PATCH 169/183 staging: comedi: cb_pcidas64: fix incorrect AI range code handling
In reply to Luis Henriques3.16.7-ckt8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Abbott <[email protected]>
commit be8e89087ec2d2c8a1ad1e3db64bf4efdfc3c298 upstream.
The hardware range code values and list of valid ranges for the AI subdevice is incorrect for several supported boards. The hardware range code values for all boards except PCI-DAS4020/12 is determined by calling ai_range_bits_6xxx() based on the maximum voltage of the range and whether it is bipolar or unipolar, however it only returns the correct hardware range code for the PCI-DAS60xx boards. For PCI-DAS6402/16 (and /12) it returns the wrong code for the unipolar ranges. For PCI-DAS64/Mx/16 it returns the wrong code for all the ranges and the comedi range table is incorrect.
Change ai_range_bits_6xxx() to use a look-up table pointed to by new member ai_range_codes of struct pcidas64_board to map the comedi range table indices to the hardware range codes. Use a new comedi range table for the PCI-DAS64/Mx/16 boards (and the commented out variants).
--- drivers/staging/comedi/drivers/cb_pcidas64.c | 122 ++++++++++++++++----------- 1 file changed, 75 insertions(+), 47 deletions(-)
drivers/staging/comedi/drivers/cb_pcidas64.c +75 -47
@@ -441,6 +441,29 @@ static const struct comedi_lrange ai_ranges_64xx = { } }; +static const uint8_t ai_range_code_64xx[8 ] = { +0x0 ,0x1 ,0x2 ,0x3 ,/* bipolar 10, 5, 2,5, 1.25 */ +0x8 ,0x9 ,0xa ,0xb /* unipolar 10, 5, 2.5, 1.25 */ +}; + +/* analog input ranges for 64-Mx boards */ +static const struct comedi_lrange ai_ranges_64_mx = { +7 , { +BIP_RANGE (5 ), +BIP_RANGE (2.5 ), +BIP_RANGE (1.25 ), +BIP_RANGE (0.625 ), +UNI_RANGE (5 ), +UNI_RANGE (2.5 ), +UNI_RANGE (1.25 ) + } +}; + +static const uint8_t ai_range_code_64_mx[7 ] = { +0x0 ,0x1 ,0x2 ,0x3 ,/* bipolar 5, 2.5, 1.25, 0.625 */ +0x9 ,0xa ,0xb /* unipolar 5, 2.5, 1.25 */ +}; +/* analog input ranges for 60xx boards */ static const struct comedi_lrange ai_ranges_60xx = {4 , {
@@ -451,6 +474,10 @@ static const struct comedi_lrange ai_ranges_60xx = { } }; +static const uint8_t ai_range_code_60xx[4 ] = { +0x0 ,0x1 ,0x4 ,0x7 /* bipolar 10, 5, 0.5, 0.05 */ +}; +/* analog input ranges for 6030, etc boards */ static const struct comedi_lrange ai_ranges_6030 = {14 , {
@@ -471,6 +498,11 @@ static const struct comedi_lrange ai_ranges_6030 = { } }; +static const uint8_t ai_range_code_6030[14 ] = { +0x0 ,0x1 ,0x2 ,0x3 ,0x4 ,0x5 ,0x6 ,/* bip 10, 5, 2, 1, 0.5, 0.2, 0.1 */ +0x9 ,0xa ,0xb ,0xc ,0xd ,0xe ,0xf /* uni 10, 5, 2, 1, 0.5, 0.2, 0.1 */ +}; +/* analog input ranges for 6052, etc boards */ static const struct comedi_lrange ai_ranges_6052 = {15 , {
@@ -492,6 +524,11 @@ static const struct comedi_lrange ai_ranges_6052 = { } }; +static const uint8_t ai_range_code_6052[15 ] = { +0x0 ,0x1 ,0x2 ,0x3 ,0x4 ,0x5 ,0x6 ,0x7 ,/* bipolar 10 ... 0.05 */ +0x9 ,0xa ,0xb ,0xc ,0xd ,0xe ,0xf /* unipolar 10 ... 0.1 */ +}; +/* analog input ranges for 4020 board */ static const struct comedi_lrange ai_ranges_4020 = {2 , {
@@ -595,6 +632,7 @@ struct pcidas64_board {int ai_bits;/* analog input resolution */ int ai_speed;/* fastest conversion period in ns */ const struct comedi_lrange *ai_range_table; +const uint8_t *ai_range_code;int ao_nchan;/* number of analog out channels */ int ao_bits;/* analog output resolution */ int ao_scan_speed;/* analog output scan speed */
@@ -653,6 +691,7 @@ static const struct pcidas64_board pcidas64_boards[] = { .ao_scan_speed = 10000, .layout = LAYOUT_64XX, .ai_range_table = &ai_ranges_64xx, + .ai_range_code = ai_range_code_64xx, .ao_range_table = &ao_ranges_64xx, .ao_range_code = ao_range_code_64xx, .ai_fifo = &ai_fifo_64xx,
@@ -668,6 +707,7 @@ static const struct pcidas64_board pcidas64_boards[] = { .ao_scan_speed = 10000, .layout = LAYOUT_64XX, .ai_range_table = &ai_ranges_64xx, + .ai_range_code = ai_range_code_64xx, .ao_range_table = &ao_ranges_64xx, .ao_range_code = ao_range_code_64xx, .ai_fifo = &ai_fifo_64xx,
@@ -682,7 +722,8 @@ static const struct pcidas64_board pcidas64_boards[] = { .ao_bits = 16, .ao_scan_speed = 10000, .layout = LAYOUT_64XX, - .ai_range_table = &ai_ranges_64xx, + .ai_range_table = &ai_ranges_64_mx, + .ai_range_code = ai_range_code_64_mx, .ao_range_table = &ao_ranges_64xx, .ao_range_code = ao_range_code_64xx, .ai_fifo = &ai_fifo_64xx,
@@ -697,7 +738,8 @@ static const struct pcidas64_board pcidas64_boards[] = { .ao_bits = 16, .ao_scan_speed = 10000, .layout = LAYOUT_64XX, - .ai_range_table = &ai_ranges_64xx, + .ai_range_table = &ai_ranges_64_mx, + .ai_range_code = ai_range_code_64_mx, .ao_range_table = &ao_ranges_64xx, .ao_range_code = ao_range_code_64xx, .ai_fifo = &ai_fifo_64xx,
@@ -712,7 +754,8 @@ static const struct pcidas64_board pcidas64_boards[] = { .ao_bits = 16, .ao_scan_speed = 10000, .layout = LAYOUT_64XX, - .ai_range_table = &ai_ranges_64xx, + .ai_range_table = &ai_ranges_64_mx, + .ai_range_code = ai_range_code_64_mx, .ao_range_table = &ao_ranges_64xx, .ao_range_code = ao_range_code_64xx, .ai_fifo = &ai_fifo_64xx,
@@ -727,6 +770,7 @@ static const struct pcidas64_board pcidas64_boards[] = { .ao_bits = 16, .layout = LAYOUT_60XX, .ai_range_table = &ai_ranges_60xx, + .ai_range_code = ai_range_code_60xx, .ao_range_table = &range_bipolar10, .ao_range_code = ao_range_code_60xx, .ai_fifo = &ai_fifo_60xx,
@@ -742,6 +786,7 @@ static const struct pcidas64_board pcidas64_boards[] = { .ao_scan_speed = 100000, .layout = LAYOUT_60XX, .ai_range_table = &ai_ranges_60xx, + .ai_range_code = ai_range_code_60xx, .ao_range_table = &range_bipolar10, .ao_range_code = ao_range_code_60xx, .ai_fifo = &ai_fifo_60xx,
@@ -756,6 +801,7 @@ static const struct pcidas64_board pcidas64_boards[] = { .ao_scan_speed = 100000, .layout = LAYOUT_60XX, .ai_range_table = &ai_ranges_60xx, + .ai_range_code = ai_range_code_60xx, .ao_range_table = &range_bipolar10, .ao_range_code = ao_range_code_60xx, .ai_fifo = &ai_fifo_60xx,
@@ -771,6 +817,7 @@ static const struct pcidas64_board pcidas64_boards[] = { .ao_scan_speed = 100000, .layout = LAYOUT_60XX, .ai_range_table = &ai_ranges_60xx, + .ai_range_code = ai_range_code_60xx, .ao_range_table = &range_bipolar10, .ao_range_code = ao_range_code_60xx, .ai_fifo = &ai_fifo_60xx,
@@ -786,6 +833,7 @@ static const struct pcidas64_board pcidas64_boards[] = { .ao_scan_speed = 10000, .layout = LAYOUT_60XX, .ai_range_table = &ai_ranges_6030, + .ai_range_code = ai_range_code_6030, .ao_range_table = &ao_ranges_6030, .ao_range_code = ao_range_code_6030, .ai_fifo = &ai_fifo_60xx,
@@ -801,6 +849,7 @@ static const struct pcidas64_board pcidas64_boards[] = { .ao_scan_speed = 10000, .layout = LAYOUT_60XX, .ai_range_table = &ai_ranges_6030, + .ai_range_code = ai_range_code_6030, .ao_range_table = &ao_ranges_6030, .ao_range_code = ao_range_code_6030, .ai_fifo = &ai_fifo_60xx,
@@ -814,6 +863,7 @@ static const struct pcidas64_board pcidas64_boards[] = { .ao_nchan = 0, .layout = LAYOUT_60XX, .ai_range_table = &ai_ranges_6030, + .ai_range_code = ai_range_code_6030, .ai_fifo = &ai_fifo_60xx, .has_8255 = 0, },
@@ -825,6 +875,7 @@ static const struct pcidas64_board pcidas64_boards[] = { .ao_nchan = 0, .layout = LAYOUT_60XX, .ai_range_table = &ai_ranges_6030, + .ai_range_code = ai_range_code_6030, .ai_fifo = &ai_fifo_60xx, .has_8255 = 0, },
@@ -837,6 +888,7 @@ static const struct pcidas64_board pcidas64_boards[] = { .ao_scan_speed = 0, .layout = LAYOUT_60XX, .ai_range_table = &ai_ranges_60xx, + .ai_range_code = ai_range_code_60xx, .ai_fifo = &ai_fifo_60xx, .has_8255 = 0, },
@@ -850,6 +902,7 @@ static const struct pcidas64_board pcidas64_boards[] = { .ao_scan_speed = 100000, .layout = LAYOUT_60XX, .ai_range_table = &ai_ranges_60xx, + .ai_range_code = ai_range_code_60xx, .ao_range_table = &range_bipolar10, .ao_range_code = ao_range_code_60xx, .ai_fifo = &ai_fifo_60xx,
@@ -865,6 +918,7 @@ static const struct pcidas64_board pcidas64_boards[] = { .ao_scan_speed = 100000, .layout = LAYOUT_60XX, .ai_range_table = &ai_ranges_60xx, + .ai_range_code = ai_range_code_60xx, .ao_range_table = &range_bipolar10, .ao_range_code = ao_range_code_60xx, .ai_fifo = &ai_fifo_60xx,
@@ -880,6 +934,7 @@ static const struct pcidas64_board pcidas64_boards[] = { .ao_scan_speed = 1000, .layout = LAYOUT_60XX, .ai_range_table = &ai_ranges_6052, + .ai_range_code = ai_range_code_6052, .ao_range_table = &ao_ranges_6030, .ao_range_code = ao_range_code_6030, .ai_fifo = &ai_fifo_60xx,
@@ -895,6 +950,7 @@ static const struct pcidas64_board pcidas64_boards[] = { .ao_scan_speed = 3333, .layout = LAYOUT_60XX, .ai_range_table = &ai_ranges_6052, + .ai_range_code = ai_range_code_6052, .ao_range_table = &ao_ranges_6030, .ao_range_code = ao_range_code_6030, .ai_fifo = &ai_fifo_60xx,
@@ -910,6 +966,7 @@ static const struct pcidas64_board pcidas64_boards[] = { .ao_scan_speed = 1000, .layout = LAYOUT_60XX, .ai_range_table = &ai_ranges_6052, + .ai_range_code = ai_range_code_6052, .ao_range_table = &ao_ranges_6030, .ao_range_code = ao_range_code_6030, .ai_fifo = &ai_fifo_60xx,
@@ -925,6 +982,7 @@ static const struct pcidas64_board pcidas64_boards[] = { .ao_scan_speed = 1000, .layout = LAYOUT_60XX, .ai_range_table = &ai_ranges_6052, + .ai_range_code = ai_range_code_6052, .ao_range_table = &ao_ranges_6030, .ao_range_code = ao_range_code_6030, .ai_fifo = &ai_fifo_60xx,
@@ -959,6 +1017,7 @@ static const struct pcidas64_board pcidas64_boards[] = { .ao_scan_speed = 10000, .layout = LAYOUT_64XX, .ai_range_table = &ai_ranges_64xx, + .ai_range_code = ai_range_code_64xx, .ai_fifo = ai_fifo_64xx, .has_8255 = 1, },
@@ -970,7 +1029,8 @@ static const struct pcidas64_board pcidas64_boards[] = { .ao_nchan = 0, .ao_scan_speed = 10000, .layout = LAYOUT_64XX, - .ai_range_table = &ai_ranges_64xx, + .ai_range_table = &ai_ranges_64_mx, + .ai_range_code = ai_range_code_64_mx, .ai_fifo = ai_fifo_64xx, .has_8255 = 1, },
@@ -982,7 +1042,8 @@ static const struct pcidas64_board pcidas64_boards[] = { .ao_nchan = 0, .ao_scan_speed = 10000, .layout = LAYOUT_64XX, - .ai_range_table = &ai_ranges_64xx, + .ai_range_table = &ai_ranges_64_mx, + .ai_range_code = ai_range_code_64_mx, .ai_fifo = ai_fifo_64xx, .has_8255 = 1, },
@@ -994,7 +1055,8 @@ static const struct pcidas64_board pcidas64_boards[] = { .ao_nchan = 0, .ao_scan_speed = 10000, .layout = LAYOUT_64XX, - .ai_range_table = &ai_ranges_64xx, + .ai_range_table = &ai_ranges_64_mx, + .ai_range_code = ai_range_code_64_mx, .ai_fifo = ai_fifo_64xx, .has_8255 = 1, },
@@ -1006,7 +1068,8 @@ static const struct pcidas64_board pcidas64_boards[] = { .ao_nchan = 2, .ao_scan_speed = 10000, .layout = LAYOUT_64XX, - .ai_range_table = &ai_ranges_64xx, + .ai_range_table = &ai_ranges_64_mx, + .ai_range_code = ai_range_code_64_mx, .ai_fifo = ai_fifo_64xx, .has_8255 = 1, },
@@ -1018,7 +1081,8 @@ static const struct pcidas64_board pcidas64_boards[] = { .ao_nchan = 2, .ao_scan_speed = 10000, .layout = LAYOUT_64XX, - .ai_range_table = &ai_ranges_64xx, + .ai_range_table = &ai_ranges_64_mx, + .ai_range_code = ai_range_code_64_mx, .ai_fifo = ai_fifo_64xx, .has_8255 = 1, },
@@ -1030,7 +1094,8 @@ static const struct pcidas64_board pcidas64_boards[] = { .ao_nchan = 2, .ao_scan_speed = 10000, .layout = LAYOUT_64XX, - .ai_range_table = &ai_ranges_64xx, + .ai_range_table = &ai_ranges_64_mx, + .ai_range_code = ai_range_code_64_mx, .ai_fifo = ai_fifo_64xx, .has_8255 = 1, },
@@ -1127,45 +1192,8 @@ static unsigned int ai_range_bits_6xxx(const struct comedi_device *dev, unsigned int range_index) {const struct pcidas64_board *thisboard =comedi_board (dev); -const struct comedi_krange *range = - &thisboard->ai_range_table->range[range_index]; -unsigned int bits =0 ; -switch (range->max) { -case 10000000 : - bits =0x000 ; -break ; -case 5000000 : - bits =0x100 ; -break ; -case 2000000 : -case 2500000 : - bits =0x200 ; -break ; -case 1000000 : -case 1250000 : - bits =0x300 ; -break ; -case 500000 : - bits =0x400 ; -break ; -case 200000 : -case 250000 : - bits =0x500 ; -break ; -case 100000 : - bits =0x600 ; -break ; -case 50000 : - bits =0x700 ; -break ; -default : -comedi_error (dev,"bug! in ai_range_bits_6xxx" ); -break ; - } -if (range->min ==0 ) - bits +=0x900 ; -return bits; +return thisboard->ai_range_code[range_index] <<8 ; } static unsigned int hw_revision(const struct comedi_device *dev,
PATCH 170/183 target: Fix R_HOLDER bit usage for AllRegistrants
In reply to Luis Henriques3.16.7-ckt8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
commit d16ca7c5198fd668db10d2c7b048ed3359c12c54 upstream.
This patch fixes the usage of R_HOLDER bit for an All Registrants reservation in READ_FULL_STATUS, where only the registration who issued RESERVE was being reported as having an active reservation.
It changes core_scsi3_pri_read_full_status() to check ahead of the list walk of active registrations to see if All Registrants is active, and if so set R_HOLDER bit and scope/type fields for all active registrations.
--- drivers/target/target_core_pr.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-)
drivers/target/target_core_pr.c +23 -3
@@ -3855,7 +3855,8 @@ core_scsi3_pri_read_full_status(struct se_cmd *cmd)unsigned char *buf;u32 add_desc_len =0 , add_len =0 , desc_len, exp_desc_len;u32 off =8 ;/* off into first Full Status descriptor */ -int format_code =0 ; +int format_code =0 , pr_res_type =0 , pr_res_scope =0 ; +bool all_reg = false;if (cmd->data_length <8 ) { pr_err("PRIN SA READ_FULL_STATUS SCSI Data Length: %u"
@@ -3872,6 +3873,19 @@ core_scsi3_pri_read_full_status(struct se_cmd *cmd) buf[2 ] = ((dev->t10_pr.pr_generation >>8 ) &0xff ); buf[3 ] = (dev->t10_pr.pr_generation &0xff ); +spin_lock (&dev->dev_reservation_lock); +if (dev->dev_pr_res_holder) { +struct t10_pr_registration *pr_holder = dev->dev_pr_res_holder; + +if (pr_holder->pr_res_type ==PR_TYPE_WRITE_EXCLUSIVE_ALLREG || + pr_holder->pr_res_type ==PR_TYPE_EXCLUSIVE_ACCESS_ALLREG ) { + all_reg = true; + pr_res_type = pr_holder->pr_res_type; + pr_res_scope = pr_holder->pr_res_scope; + } + } +spin_unlock (&dev->dev_reservation_lock); +spin_lock (&pr_tmpl->registration_lock);list_for_each_entry_safe (pr_reg, pr_reg_tmp, &pr_tmpl->registration_list, pr_reg_list) {
@@ -3921,14 +3935,20 @@ core_scsi3_pri_read_full_status(struct se_cmd *cmd)* reservation holder for PR_HOLDER bit. * * Also, if this registration is the reservation -* holder, fill in SCOPE and TYPE in the next byte. +* holder or there is an All Registrants reservation +* active, fill in SCOPE and TYPE in the next byte. */ if (pr_reg->pr_res_holder) { buf[off++] |=0x01 ; buf[off++] = (pr_reg->pr_res_scope &0xf0 ) | (pr_reg->pr_res_type &0x0f ); - }else + }else if (all_reg) { + buf[off++] |=0x01 ; + buf[off++] = (pr_res_scope &0xf0 ) | + (pr_res_type &0x0f ); + }else { off +=2 ; + } off +=4 ;/* Skip over reserved area */ /*
PATCH 171/183 target: Avoid dropping AllRegistrants reservation during unregister
In reply to Luis Henriques3.16.7-ckt8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
commit 6c3c9baa0debeb4bcc52a78c4463a0a97518de10 upstream.
This patch fixes an issue with AllRegistrants reservations where an unregister operation by the I_T nexus reservation holder would incorrectly drop the reservation, instead of waiting until the last active I_T nexus is unregistered as per SPC-4.
This includes updating __core_scsi3_complete_pro_release() to reset dev->dev_pr_res_holder with another pr_reg for this special case, as well as a new 'unreg' parameter to determine when the release is occuring from an implicit unregister, vs. explicit RELEASE.
It also adds special handling in core_scsi3_free_pr_reg_from_nacl() to release the left-over pr_res_holder, now that pr_reg is deleted from pr_reg_list within __core_scsi3_complete_pro_release().
--- drivers/target/target_core_pr.c | 87 ++++++++++++++++++++++++++++++----------- 1 file changed, 65 insertions(+), 22 deletions(-)
drivers/target/target_core_pr.c +65 -22
@@ -76,7 +76,7 @@ enum preempt_type { };static void __core_scsi3_complete_pro_release (struct se_device *,struct se_node_acl *, -struct t10_pr_registration *,int ); +struct t10_pr_registration *,int ,int );static sense_reason_t target_scsi2_reservation_check (struct se_cmd *cmd)
@@ -1186,7 +1186,7 @@ static int core_scsi3_check_implicit_release(* service action with the SERVICE ACTION RESERVATION KEY * field set to zero (see 5.7.11.3). */ -__core_scsi3_complete_pro_release (dev, nacl, pr_reg,0 ); +__core_scsi3_complete_pro_release (dev, nacl, pr_reg,0 ,1 ); ret =1 ;/* * For 'All Registrants' reservation types, all existing
@@ -1228,7 +1228,8 @@ static void __core_scsi3_free_registration( pr_reg->pr_reg_deve->def_pr_registered =0 ; pr_reg->pr_reg_deve->pr_res_key =0 ; -list_del (&pr_reg->pr_reg_list); +if (!list_empty (&pr_reg->pr_reg_list)) +list_del (&pr_reg->pr_reg_list);/* * Caller accessing *pr_reg using core_scsi3_locate_pr_reg(), * so call core_scsi3_put_pr_reg() to decrement our reference.
@@ -1280,6 +1281,7 @@ void core_scsi3_free_pr_reg_from_nacl( {struct t10_reservation *pr_tmpl = &dev->t10_pr;struct t10_pr_registration *pr_reg, *pr_reg_tmp, *pr_res_holder; +bool free_reg = false;/* * If the passed se_node_acl matches the reservation holder, * release the reservation.
@@ -1287,13 +1289,18 @@ void core_scsi3_free_pr_reg_from_nacl(spin_lock (&dev->dev_reservation_lock); pr_res_holder = dev->dev_pr_res_holder;if ((pr_res_holder !=NULL ) && - (pr_res_holder->pr_reg_nacl == nacl)) -__core_scsi3_complete_pro_release (dev, nacl, pr_res_holder,0 ); + (pr_res_holder->pr_reg_nacl == nacl)) { +__core_scsi3_complete_pro_release (dev, nacl, pr_res_holder,0 ,1 ); + free_reg = true; + }spin_unlock (&dev->dev_reservation_lock);/* * Release any registration associated with the struct se_node_acl. */ spin_lock (&pr_tmpl->registration_lock); +if (pr_res_holder && free_reg) +__core_scsi3_free_registration (dev, pr_res_holder,NULL ,0 ); +list_for_each_entry_safe (pr_reg, pr_reg_tmp, &pr_tmpl->registration_list, pr_reg_list) {
@@ -1316,7 +1323,7 @@ void core_scsi3_free_all_registrations(if (pr_res_holder !=NULL ) {struct se_node_acl *pr_res_nacl = pr_res_holder->pr_reg_nacl;__core_scsi3_complete_pro_release (dev, pr_res_nacl, - pr_res_holder,0 ); + pr_res_holder,0 ,0 ); }spin_unlock (&dev->dev_reservation_lock);
@@ -2126,13 +2133,13 @@ core_scsi3_emulate_pro_register(struct se_cmd *cmd, u64 res_key, u64 sa_res_key,/* * sa_res_key=0 Unregister Reservation Key for registered I_T Nexus. */ - pr_holder =core_scsi3_check_implicit_release ( - cmd->se_dev, pr_reg); + type = pr_reg->pr_res_type; + pr_holder =core_scsi3_check_implicit_release (cmd->se_dev, + pr_reg);if (pr_holder <0 ) { ret =TCM_RESERVATION_CONFLICT ; goto out; } - type = pr_reg->pr_res_type;spin_lock (&pr_tmpl->registration_lock);/*
@@ -2406,23 +2413,59 @@ static void __core_scsi3_complete_pro_release(struct se_device *dev, struct se_node_acl *se_nacl, struct t10_pr_registration *pr_reg, - int explicit) + int explicit, + int unreg) { struct target_core_fabric_ops *tfo = se_nacl->se_tpg->se_tpg_tfo;char i_buf[PR_REG_ISID_ID_LEN ]; +int pr_res_type =0 , pr_res_scope =0 ;memset (i_buf,0 ,PR_REG_ISID_ID_LEN );core_pr_dump_initiator_port (pr_reg, i_buf,PR_REG_ISID_ID_LEN );/* * Go ahead and release the current PR reservation holder. +* If an All Registrants reservation is currently active and +* a unregister operation is requested, replace the current +* dev_pr_res_holder with another active registration. */ - dev->dev_pr_res_holder =NULL ; +if (dev->dev_pr_res_holder) { + pr_res_type = dev->dev_pr_res_holder->pr_res_type; + pr_res_scope = dev->dev_pr_res_holder->pr_res_scope; + dev->dev_pr_res_holder->pr_res_type =0 ; + dev->dev_pr_res_holder->pr_res_scope =0 ; + dev->dev_pr_res_holder->pr_res_holder =0 ; + dev->dev_pr_res_holder =NULL ; + } +if (!unreg) + goto out; -pr_debug ("SPC-3 PR [%s] Service Action: %s RELEASE cleared" -" reservation holder TYPE: %s ALL_TG_PT: %d\n" , - tfo->get_fabric_name (), (explicit) ?"explicit" :"implicit" , -core_scsi3_pr_dump_type (pr_reg->pr_res_type), - (pr_reg->pr_reg_all_tg_pt) ?1 :0 ); +spin_lock (&dev->t10_pr.registration_lock); +list_del_init (&pr_reg->pr_reg_list); +/* +* If the I_T nexus is a reservation holder, the persistent reservation +* is of an all registrants type, and the I_T nexus is the last remaining +* registered I_T nexus, then the device server shall also release the +* persistent reservation. +*/ +if (!list_empty (&dev->t10_pr.registration_list) && + ((pr_res_type ==PR_TYPE_WRITE_EXCLUSIVE_ALLREG ) || + (pr_res_type ==PR_TYPE_EXCLUSIVE_ACCESS_ALLREG ))) { + dev->dev_pr_res_holder = +list_entry (dev->t10_pr.registration_list.next, + struct t10_pr_registration, pr_reg_list); + dev->dev_pr_res_holder->pr_res_type = pr_res_type; + dev->dev_pr_res_holder->pr_res_scope = pr_res_scope; + dev->dev_pr_res_holder->pr_res_holder =1 ; + } +spin_unlock (&dev->t10_pr.registration_lock); +out: +if (!dev->dev_pr_res_holder) { +pr_debug ("SPC-3 PR [%s] Service Action: %s RELEASE cleared" +" reservation holder TYPE: %s ALL_TG_PT: %d\n" , + tfo->get_fabric_name (), (explicit) ?"explicit" : +"implicit" ,core_scsi3_pr_dump_type (pr_res_type), + (pr_reg->pr_reg_all_tg_pt) ?1 :0 ); + }pr_debug ("SPC-3 PR [%s] RELEASE Node: %s%s\n" , tfo->get_fabric_name (), se_nacl->initiatorname, i_buf);
@@ -2553,7 +2596,7 @@ core_scsi3_emulate_pro_release(struct se_cmd *cmd, int type, int scope,* server shall not establish a unit attention condition. */ __core_scsi3_complete_pro_release (dev, se_sess->se_node_acl, - pr_reg,1 ); + pr_reg,1 ,0 );spin_unlock (&dev->dev_reservation_lock);
@@ -2641,7 +2684,7 @@ core_scsi3_emulate_pro_clear(struct se_cmd *cmd, u64 res_key)if (pr_res_holder) {struct se_node_acl *pr_res_nacl = pr_res_holder->pr_reg_nacl;__core_scsi3_complete_pro_release (dev, pr_res_nacl, - pr_res_holder,0 ); + pr_res_holder,0 ,0 ); }spin_unlock (&dev->dev_reservation_lock);/*
@@ -2700,7 +2743,7 @@ static void __core_scsi3_complete_pro_preempt(*/ if (dev->dev_pr_res_holder)__core_scsi3_complete_pro_release (dev, nacl, - dev->dev_pr_res_holder,0 ); + dev->dev_pr_res_holder,0 ,0 ); dev->dev_pr_res_holder = pr_reg; pr_reg->pr_res_holder =1 ;
@@ -2944,8 +2987,8 @@ core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key,*/ if (pr_reg_n != pr_res_holder)__core_scsi3_complete_pro_release (dev, - pr_res_holder->pr_reg_nacl, - dev->dev_pr_res_holder,0 ); + pr_res_holder->pr_reg_nacl, + dev->dev_pr_res_holder,0 ,0 );/* * b) Remove the registrations for all I_T nexuses identified * by the SERVICE ACTION RESERVATION KEY field, except the
@@ -3415,7 +3458,7 @@ after_iport_check:* holder (i.e., the I_T nexus on which the */ __core_scsi3_complete_pro_release (dev, pr_res_nacl, - dev->dev_pr_res_holder,0 ); + dev->dev_pr_res_holder,0 ,0 );/* * g) Move the persistent reservation to the specified I_T nexus using * the same scope and type as the persistent reservation released in
PATCH 172/183 target: Allow AllRegistrants to re-RESERVE existing reservation
In reply to Luis Henriques3.16.7-ckt8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
commit ae450e246e8540300699480a3780a420a028b73f upstream.
This patch changes core_scsi3_pro_release() logic to allow an existing AllRegistrants type reservation to be re-reserved by any registered I_T nexus.
This addresses a issue where AllRegistrants type RESERVE was receiving RESERVATION_CONFLICT status if dev_pr_res_holder did not match the same I_T nexus, instead of just returning GOOD status following spc4r34 Section 5.9.9:
"If the device server receives a PERSISTENT RESERVE OUT command
with RESERVE service action where the TYPE field and the SCOPE field contain the same values as the existing type and scope from a persistent reservation holder, it shall not make any change to the existing persistent reservation and shall complete the command with GOOD status."
--- drivers/target/target_core_pr.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/target/target_core_pr.c +4 -1
@@ -2297,6 +2297,7 @@ core_scsi3_pro_reserve(struct se_cmd *cmd, int type, int scope, u64 res_key)spin_lock (&dev->dev_reservation_lock); pr_res_holder = dev->dev_pr_res_holder;if (pr_res_holder) { +int pr_res_type = pr_res_holder->pr_res_type;/* * From spc4r17 Section 5.7.9: Reserving: *
@@ -2307,7 +2308,9 @@ core_scsi3_pro_reserve(struct se_cmd *cmd, int type, int scope, u64 res_key)* the logical unit, then the command shall be completed with * RESERVATION CONFLICT status. */ -if (pr_res_holder != pr_reg) { +if ((pr_res_holder != pr_reg) && + (pr_res_type !=PR_TYPE_WRITE_EXCLUSIVE_ALLREG ) && + (pr_res_type !=PR_TYPE_EXCLUSIVE_ACCESS_ALLREG )) {struct se_node_acl *pr_res_nacl = pr_res_holder->pr_reg_nacl;pr_err ("SPC-3 PR: Attempted RESERVE from" " [%s]: %s while reservation already held by"
PATCH 173/183 target: Allow Write Exclusive non-reservation holders to READ
In reply to Luis Henriques3.16.7-ckt8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Lee Duncan <[email protected]>
commit 1ecc7586922662e3ca2f3f0c3f17fec8749fc621 upstream.
For PGR reservation of type Write Exclusive Access, allow all non reservation holding I_T nexuses with active registrations to READ from the device.
This addresses a bug where active registrations that attempted to READ would result in an reservation conflict.
--- drivers/target/target_core_pr.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/target/target_core_pr.c +12 -0
@@ -528,6 +528,18 @@ static int core_scsi3_pr_seq_non_holder(return 0 ; } + }else if (we && registered_nexus) { +/* +* Reads are allowed for Write Exclusive locks +* from all registrants. +*/ +if (cmd->data_direction ==DMA_FROM_DEVICE ) { +pr_debug ("Allowing READ CDB: 0x%02x for %s" +" reservation\n" , cdb[0 ], +core_scsi3_pr_dump_type (pr_reg_type)); + +return 0 ; + } } pr_debug("%s Conflict for %sregistered nexus %s CDB: 0x%2x" " for %s reservation\n", transport_dump_cmd_direction(cmd),
PATCH 174/183 vhost/scsi: potential memory corruption
In reply to Luis Henriques3.16.7-ckt8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 59c816c1f24df0204e01851431d3bab3eb76719c upstream.
This code in vhost_scsi_make_tpg() is confusing because we limit "tpgt" to UINT_MAX but the data type of "tpg->tport_tpgt" and that is a u16.
I looked at the context and it turns out that in vhost_scsi_set_endpoint(), "tpg->tport_tpgt" is used as an offset into the vs_tpg[] array which has VHOST_SCSI_MAX_TARGET (256) elements so anything higher than 255 then it is invalid. I have made that the limit now.
In vhost_scsi_send_evt() we mask away values higher than 255, but now that the limit has changed, we don't need the mask.
[ luis: backported to 3.16: functions rename:
- tcm_vhost_send_evt -> vhost_scsi_send_evt
- tcm_vhost_make_tpg -> vhost_scsi_make_tpg ]
--- drivers/vhost/scsi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/vhost/scsi.c +3 -3
@@ -1251,7 +1251,7 @@ tcm_vhost_send_evt(struct vhost_scsi *vs,* lun[4-7] need to be zero according to virtio-scsi spec. */ evt->event.lun[0 ] =0x01 ; - evt->event.lun[1 ] = tpg->tport_tpgt &0xFF ; + evt->event.lun[1 ] = tpg->tport_tpgt;if (lun->unpacked_lun >=256 ) evt->event.lun[2 ] = lun->unpacked_lun >>8 |0x40 ; evt->event.lun[3 ] = lun->unpacked_lun &0xFF ;
@@ -2122,12 +2122,12 @@ tcm_vhost_make_tpg(struct se_wwn *wwn, struct tcm_vhost_tport, tport_wwn);struct tcm_vhost_tpg *tpg; -unsigned long tpgt; +u16 tpgt;int ret;if (strstr (name,"tpgt_" ) != name)return ERR_PTR (-EINVAL ); -if (kstrtoul (name +5 ,10 , &tpgt) || tpgt >UINT_MAX ) +if (kstrtou16 (name +5 ,10 , &tpgt) || tpgt >=VHOST_SCSI_MAX_TARGET )return ERR_PTR (-EINVAL ); tpg =kzalloc (sizeof (struct tcm_vhost_tpg ),GFP_KERNEL );
PATCH 175/183 clk: sunxi: Support factor clocks with N factor starting not from 0
In reply to Luis Henriques3.16.7-ckt8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen-Yu Tsai <[email protected]>
commit 9a5e6c7eb5ccbb5f0d3a1dffce135f0a727f40e1 upstream.
The PLLs on newer Allwinner SoC's, such as the A31 and A23, have a N multiplier factor that starts from 1, not 0.
This patch adds an option to the factor clk driver's config data structures to specify the base value of N.
--- drivers/clk/sunxi/clk-factors.c | 2 +- drivers/clk/sunxi/clk-factors.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/clk/sunxi/clk-factors.c +1 -1
@@ -62,7 +62,7 @@ static unsigned long clk_factors_recalc_rate(struct clk_hw *hw, p =FACTOR_GET (config->pshift, config->pwidth, reg);/* Calculate the rate */ - rate = (parent_rate * n * (k +1 ) >> p) / (m +1 ); + rate = (parent_rate * (n + config->n_start) * (k +1 ) >> p) / (m +1 );return rate; }
drivers/clk/sunxi/clk-factors.h +1 -0
@@ -15,6 +15,7 @@ struct clk_factors_config {u8 mwidth;u8 pshift;u8 pwidth; +u8 n_start; };struct clk_factors {
PATCH 176/183 sunxi: clk: Set sun6i-pll1 n_start = 1
In reply to Luis Henriques3.16.7-ckt8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit 76820fcf7aa5a418b69cb7bed31b62d1feb1d6ad upstream.
For all pll-s on sun6i n == 0 means use a multiplier of 1, rather then 0 as it means on sun4i / sun5i / sun7i. n_start = 1 is already correctly set for sun6i pll6, but was missing for pll1, this commit fixes this.
--- drivers/clk/sunxi/clk-sunxi.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/sunxi/clk-sunxi.c +1 -0
@@ -420,6 +420,7 @@ static struct clk_factors_config sun6i_a31_pll1_config = { .kwidth = 2, .mshift = 0, .mwidth = 2, + .n_start = 1, };static struct clk_factors_config sun4i_pll5_config = {
PATCH 177/183 HID: wacom: Report ABS_MISC event for Cintiq Companion Hybrid
In reply to Luis Henriques3.16.7-ckt8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Gerecke <[email protected]>
commit 33e5df0e0e32027866e9fb00451952998fc957f2 upstream.
It appears that the Cintiq Companion Hybrid does not send an ABS_MISC event to userspace when any of its ExpressKeys are pressed. This is not strictly necessary now that the pad exists on its own device, but should be fixed for consistency's sake.
Traditionally both the stylus and pad shared the same device node, and xf86-input-wacom would use ABS_MISC for disambiguation. Not sending this causes the Hybrid to behave incorrectly with xf86-input-wacom beginning with its 8f44f3 commit.
--- drivers/input/tablet/wacom_wac.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/input/tablet/wacom_wac.c +6 -0
@@ -698,6 +698,12 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)input_report_key (input,BTN_7 , (data[4 ] &0x40 ));/* Left */ input_report_key (input,BTN_8 , (data[4 ] &0x80 ));/* Down */ input_report_key (input,BTN_0 , (data[3 ] &0x01 ));/* Center */ + +if (data[4 ] | (data[3 ] &0x01 )) { +input_report_abs (input,ABS_MISC ,PAD_DEVICE_ID ); + }else { +input_report_abs (input,ABS_MISC ,0 ); + } }else if (features->type >=INTUOS5S && features->type <=INTUOSPL ) {int i;
PATCH 178/183 mm: softdirty: unmapped addresses between VMAs are clean
In reply to Luis Henriques3.16.7-ckt8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Feiner <[email protected]>
commit 81d0fa623c5b8dbd5279d9713094b0f9b0a00fb4 upstream.
If a /proc/pid/pagemap read spans a [VMA, an unmapped region, then a VM_SOFTDIRTY VMA], the virtual pages in the unmapped region are reported as softdirty. Here's a program to demonstrate the bug:
int main() {
const uint64_t PAGEMAP_SOFTDIRTY = 1ul << 55;
uint64_t pme[3];
int fd = open("/proc/self/pagemap", O_RDONLY);;
char *m = mmap(NULL, 3 * getpagesize(), PROT_READ,
MAP_ANONYMOUS | MAP_SHARED, -1, 0);
munmap(m + getpagesize(), getpagesize());
pread(fd, pme, 24, (unsigned long) m / getpagesize() * 8);
assert(pme[0] & PAGEMAP_SOFTDIRTY); /* passes */
assert(!(pme[1] & PAGEMAP_SOFTDIRTY)); /* fails */
assert(pme[2] & PAGEMAP_SOFTDIRTY); /* passes */
return 0;
}(Note that all pages in new VMAs are softdirty until cleared).
Tested:
Used the program given above. I'm going to include this code in a selftest in the future.
[ luis: 3.16-stable prereq for:
05fbf357d941 "proc/pagemap: walk page tables under pte lock" ]
--- fs/proc/task_mmu.c | 61 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 21 deletions(-)
fs/proc/task_mmu.c +40 -21
@@ -1005,7 +1005,6 @@ static int pagemap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,spinlock_t *ptl;pte_t *pte;int err =0 ; -pagemap_entry_t pme =make_pme (PM_NOT_PRESENT (pm->v2));/* find the first VMA at or above 'addr' */ vma =find_vma (walk->mm, addr);
@@ -1019,6 +1018,7 @@ static int pagemap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,for (; addr != end; addr +=PAGE_SIZE ) {unsigned long offset; +pagemap_entry_t pme; offset = (addr & ~PAGEMAP_WALK_MASK ) >>PAGE_SHIFT ;
@@ -1033,32 +1033,51 @@ static int pagemap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,if (pmd_trans_unstable (pmd))return 0 ; -for (; addr != end; addr +=PAGE_SIZE ) { -int flags2; - -/* check to see if we've left 'vma' behind -* and need a new, higher one */ -if (vma && (addr >= vma->vm_end)) { - vma =find_vma (walk->mm, addr); -if (vma && (vma->vm_flags &VM_SOFTDIRTY )) - flags2 = __PM_SOFT_DIRTY; -else - flags2 =0 ; - pme =make_pme (PM_NOT_PRESENT (pm->v2) |PM_STATUS2 (pm->v2, flags2)); + +while (1 ) { +/* End of address space hole, which we mark as non-present. */ +unsigned long hole_end; + +if (vma) + hole_end =min (end, vma->vm_start); +else + hole_end = end; + +for (; addr < hole_end; addr +=PAGE_SIZE ) { +pagemap_entry_t pme =make_pme (PM_NOT_PRESENT (pm->v2)); + + err =add_to_pagemap (addr, &pme, pm); +if (err) +return err; } -/* check that 'vma' actually covers this address, -* and that it isn't a huge page vma */ -if (vma && (vma->vm_start <= addr) && - !is_vm_hugetlb_page (vma)) { +if (!vma || vma->vm_start >= end) +break ; +/* +* We can't possibly be in a hugetlb VMA. In general, +* for a mm_walk with a pmd_entry and a hugetlb_entry, +* the pmd_entry can only be called on addresses in a +* hugetlb if the walk starts in a non-hugetlb VMA and +* spans a hugepage VMA. Since pagemap_read walks are +* PMD-sized and PMD-aligned, this will never be true. +*/ +BUG_ON (is_vm_hugetlb_page (vma)); + +/* Addresses in the VMA. */ +for (; addr <min (end, vma->vm_end); addr +=PAGE_SIZE ) { +pagemap_entry_t pme; pte =pte_offset_map (pmd, addr);pte_to_pagemap_entry (&pme, pm, vma, addr, *pte); -/* unmap before userspace copy */ pte_unmap (pte); + err =add_to_pagemap (addr, &pme, pm); +if (err) +return err; } - err =add_to_pagemap (addr, &pme, pm); -if (err) -return err; + +if (addr == end) +break ; + + vma =find_vma (walk->mm, addr); }cond_resched ();
PATCH 179/183 proc/pagemap: walk page tables under pte lock
In reply to Luis Henriques3.16.7-ckt8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Khlebnikov <[email protected]>
commit 05fbf357d94152171bc50f8a369390f1f16efd89 upstream.
Lockless access to pte in pagemap_pte_range() might race with page migration and trigger BUG_ON(!PageLocked()) in migration_entry_to_page():
CPU A (pagemap) CPU B (migration)
lock_page()
try_to_unmap(page, TTU_MIGRATION...)
make_migration_entry()
set_pte_at()<read *pte>pte_to_pagemap_entry()
remove_migration_ptes() unlock_page()
if(is_migration_entry())
migration_entry_to_page()
BUG_ON(!PageLocked(page))
Also lockless read might be non-atomic if pte is larger than wordsize. Other pte walkers (smaps, numa_maps, clear_refs) already lock ptes.
--- fs/proc/task_mmu.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
fs/proc/task_mmu.c +9 -5
@@ -1003,7 +1003,7 @@ static int pagemap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,struct vm_area_struct *vma;struct pagemapread *pm = walk->private;spinlock_t *ptl; -pte_t *pte; +pte_t *pte, *orig_pte;int err =0 ;/* find the first VMA at or above 'addr' */
@@ -1064,15 +1064,19 @@ static int pagemap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,BUG_ON (is_vm_hugetlb_page (vma));/* Addresses in the VMA. */ -for (; addr <min (end, vma->vm_end); addr +=PAGE_SIZE ) { + orig_pte = pte =pte_offset_map_lock (walk->mm, pmd, addr, &ptl); +for (; addr <min (end, vma->vm_end); pte++, addr +=PAGE_SIZE ) {pagemap_entry_t pme; - pte =pte_offset_map (pmd, addr); +pte_to_pagemap_entry (&pme, pm, vma, addr, *pte); -pte_unmap (pte); err =add_to_pagemap (addr, &pme, pm);if (err) -return err; +break ; } +pte_unmap_unlock (orig_pte, ptl); + +if (err) +return err;if (addr == end)break ;
PATCH 180/183 ARM: dts: am335x-bone*: usb0 is hardwired for peripheral
In reply to Luis Henriques3.16.7-ckt8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Robert Nelson <[email protected]>
commit 67fd14b3eca63b14429350e9eadc5fab709a8821 upstream.
the bb.org community was seeing random reboots before this change.
--- arch/arm/boot/dts/am335x-bone-common.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm/boot/dts/am335x-bone-common.dtsi +1 -0
@@ -198,6 +198,7 @@ &usb0 { status = "okay"; + dr_mode = "peripheral"; }; &usb1 {
PATCH 181/183 sched/rt: Reduce rq lock contention by eliminating locking of non-feasible target
In reply to Luis Henriques3.16.7-ckt8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Tim Chen <[email protected]>
commit 80e3d87b2c5582db0ab5e39610ce3707d97ba409 upstream.
This patch adds checks that prevens futile attempts to move rt tasks to a CPU with active tasks of equal or higher priority.
This reduces run queue lock contention and improves the performance of a well known OLTP benchmark by 0.7%.
--- kernel/sched/rt.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
kernel/sched/rt.c +16 -1
@@ -1336,7 +1336,12 @@ select_task_rq_rt(struct task_struct *p, int cpu, int sd_flag, int flags) curr->prio <= p->prio)) {int target =find_lowest_rq (p); -if (target !=-1 ) +/* +* Don't bother moving it if the destination CPU is +* not running a lower priority task. +*/ +if (target !=-1 && + p->prio <cpu_rq (target)->rt.highest_prio.curr) cpu = target; }rcu_read_unlock ();
@@ -1608,6 +1613,16 @@ static struct rq *find_lock_lowest_rq(struct task_struct *task, struct rq *rq) lowest_rq =cpu_rq (cpu); +if (lowest_rq->rt.highest_prio.curr <= task->prio) { +/* +* Target rq has tasks of equal or higher priority, +* retrying does not release any lock and is unlikely +* to yield a different result. +*/ + lowest_rq =NULL ; +break ; + } +/* if the prio of this runqueue changed, try again */ if (double_lock_balance (rq, lowest_rq)) {/*
PATCH 182/183 caif: remove wrong dev_net_set() call
In reply to Luis Henriques3.16.7-ckt8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Dichtel <[email protected]>
commit 8997c27ec41127bf57421cc0205413d525421ddc upstream.
src_net points to the netns where the netlink message has been received. This netns may be different from the netns where the interface is created (because the user may add IFLA_NET_NS_[PID|FD]). In this case, src_net is the link netns.
It seems wrong to override the netns in the newlink() handler because if it was not already src_net, it means that the user explicitly asks to create the netdevice in another netns.
--- drivers/net/caif/caif_hsi.c | 1 - net/caif/chnl_net.c | 1 - 2 files changed, 2 deletions(-)
drivers/net/caif/caif_hsi.c +0 -1
@@ -1415,7 +1415,6 @@ static int caif_hsi_newlink(struct net *src_net, struct net_device *dev, cfhsi =netdev_priv (dev);cfhsi_netlink_parms (data, cfhsi); -dev_net_set (cfhsi->ndev, src_net); get_ops =symbol_get (cfhsi_get_ops);if (!get_ops) {
net/caif/chnl_net.c +0 -1
@@ -470,7 +470,6 @@ static int ipcaif_newlink(struct net *src_net, struct net_device *dev,ASSERT_RTNL (); caifdev =netdev_priv (dev);caif_netlink_parms (data, &caifdev->conn_req); -dev_net_set (caifdev->netdev, src_net); ret =register_netdevice (dev);if (ret)
PATCH 183/183 quota: Store maximum space limit in bytes
In reply to Luis Henriques3.16.7-ckt8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit b10a08194c2b615955dfab2300331a90ae9344c7 upstream.
Currently maximum space limit quota format supports is in blocks however since we store space limits in bytes, this is somewhat confusing. So store the maximum limit in bytes as well. Also rename the field to match the new unit and related inode field to match the new naming scheme.
--- fs/ocfs2/quota_local.c | 4 ++-- fs/quota/dquot.c | 18 ++++-------------- fs/quota/quota_v1.c | 4 ++-- fs/quota/quota_v2.c | 10 +++++----- include/linux/quota.h | 4 ++-- 5 files changed, 15 insertions(+), 25 deletions(-)
fs/ocfs2/quota_local.c +2 -2
@@ -700,8 +700,8 @@ static int ocfs2_local_read_info(struct super_block *sb, int type)/* We don't need the lock and we have to acquire quota file locks * which will later depend on this lock */ mutex_unlock (&sb_dqopt (sb)->dqio_mutex); - info->dqi_maxblimit =0x7fffffffffffffffLL ; - info->dqi_maxilimit =0x7fffffffffffffffLL ; + info->dqi_max_spc_limit =0x7fffffffffffffffLL ; + info->dqi_max_ino_limit =0x7fffffffffffffffLL ; oinfo =kmalloc (sizeof (struct ocfs2_mem_dqinfo ),GFP_NOFS );if (!oinfo) { mlog(ML_ERROR, "failed to allocate memory for ocfs2 quota"
fs/quota/dquot.c +4 -14
@@ -2396,16 +2396,6 @@ out: }EXPORT_SYMBOL (dquot_quota_on_mount); -static inline qsize_t qbtos (qsize_t blocks) -{ -return blocks <<QIF_DQBLKSIZE_BITS ; -} - -static inline qsize_t stoqb (qsize_t space) -{ -return (space +QIF_DQBLKSIZE -1 ) >>QIF_DQBLKSIZE_BITS ; -} -/* Generic routine for getting common part of quota structure */ static void do_get_dqblk (struct dquot *dquot,struct qc_dqblk *di) {
@@ -2455,13 +2445,13 @@ static int do_set_dqblk(struct dquot *dquot, struct qc_dqblk *di)return -EINVAL ;if (((di->d_fieldmask &QC_SPC_SOFT ) && -stoqb (di->d_spc_softlimit) > dqi->dqi_maxblimit) || + di->d_spc_softlimit > dqi->dqi_max_spc_limit) || ((di->d_fieldmask &QC_SPC_HARD ) && -stoqb (di->d_spc_hardlimit) > dqi->dqi_maxblimit) || + di->d_spc_hardlimit > dqi->dqi_max_spc_limit) || ((di->d_fieldmask &QC_INO_SOFT ) && - (di->d_ino_softlimit > dqi->dqi_maxilimit)) || + (di->d_ino_softlimit > dqi->dqi_max_ino_limit)) || ((di->d_fieldmask &QC_INO_HARD ) && - (di->d_ino_hardlimit > dqi->dqi_maxilimit))) + (di->d_ino_hardlimit > dqi->dqi_max_ino_limit)))return -ERANGE ;spin_lock (&dq_data_lock);
fs/quota/quota_v1.c +2 -2
@@ -169,8 +169,8 @@ static int v1_read_file_info(struct super_block *sb, int type) } ret =0 ;/* limits are stored as unsigned 32-bit data */ - dqopt->info[type].dqi_maxblimit =0xffffffff ; - dqopt->info[type].dqi_maxilimit =0xffffffff ; + dqopt->info[type].dqi_max_spc_limit =0xffffffffULL <<QUOTABLOCK_BITS ; + dqopt->info[type].dqi_max_ino_limit =0xffffffff ; dqopt->info[type].dqi_igrace = dqblk.dqb_itime ? dqblk.dqb_itime :MAX_IQ_TIME ; dqopt->info[type].dqi_bgrace =
fs/quota/quota_v2.c +5 -5
@@ -117,12 +117,12 @@ static int v2_read_file_info(struct super_block *sb, int type) qinfo = info->dqi_priv;if (version ==0 ) {/* limits are stored as unsigned 32-bit data */ - info->dqi_maxblimit =0xffffffff ; - info->dqi_maxilimit =0xffffffff ; + info->dqi_max_spc_limit =0xffffffffULL <<QUOTABLOCK_BITS ; + info->dqi_max_ino_limit =0xffffffff ; }else { -/* used space is stored as unsigned 64-bit value */ - info->dqi_maxblimit =0xffffffffffffffffULL ;/* 2^64-1 */ - info->dqi_maxilimit =0xffffffffffffffffULL ; +/* used space is stored as unsigned 64-bit value in bytes */ + info->dqi_max_spc_limit =0xffffffffffffffffULL ;/* 2^64-1 */ + info->dqi_max_ino_limit =0xffffffffffffffffULL ; } info->dqi_bgrace =le32_to_cpu (dinfo.dqi_bgrace); info->dqi_igrace =le32_to_cpu (dinfo.dqi_igrace);
include/linux/quota.h +2 -2
@@ -211,8 +211,8 @@ struct mem_dqinfo {unsigned long dqi_flags;unsigned int dqi_bgrace;unsigned int dqi_igrace; -qsize_t dqi_maxblimit; -qsize_t dqi_maxilimit; +qsize_t dqi_max_spc_limit; +qsize_t dqi_max_ino_limit;void *dqi_priv; };