Re: [PATCH] staging :rtl8712: Free memory when kmalloc fails

2016-10-27 Thread Souptick Joarder
On Thu, Oct 27, 2016 at 11:20 AM, Greg KH  wrote:
> On Thu, Oct 27, 2016 at 11:10:09AM +0530, Souptick Joarder wrote:
>> There are few functions where we need to free previously allocated memory
>> when kmalloc fails. Else it may lead to memory leakage.
>> In  _init_cmd_priv() and _r8712_init_xmit_priv(),in few places we are not
>> freeing previously allocated memory  when kmalloc fails.
>
> Odd use of spaces, can you fix that up?
>
>> This patch will address it.
>
> That last sentance is not needed.

Ok, I will do those changes.
>
> And isn't this a new version of a patch, or am I mistaken?  If so,
> please properly version it as SubmittingPatches describes to do.

This is the new version of previous patch.
>
>>
>> Signed-off-by: Souptick joarder 
>> ---
>>  drivers/staging/rtl8712/rtl871x_cmd.c  | 5 -
>>  drivers/staging/rtl8712/rtl871x_xmit.c | 5 -
>>  2 files changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c 
>> b/drivers/staging/rtl8712/rtl871x_cmd.c
>> index b7ee5e6..04638f1 100644
>> --- a/drivers/staging/rtl8712/rtl871x_cmd.c
>> +++ b/drivers/staging/rtl8712/rtl871x_cmd.c
>> @@ -72,8 +72,11 @@ static sint _init_cmd_priv(struct cmd_priv *pcmdpriv)
>>   ((addr_t)(pcmdpriv->cmd_allocated_buf) &
>>   (CMDBUFF_ALIGN_SZ - 1));
>>   pcmdpriv->rsp_allocated_buf = kmalloc(MAX_RSPSZ + 4, GFP_ATOMIC);
>> - if (!pcmdpriv->rsp_allocated_buf)
>> + if (!pcmdpriv->rsp_allocated_buf) {
>> + kfree(pcmdpriv->cmd_allocated_buf);
>>   return _FAIL;
>> + }
>
> If you need to set the buffer to NULL, please do so, last time I thought
> you said it was required, is it really not?

This NULL is required. But I assume, last time you are not agree with it :)
So I remove it in new version.

Anyway I will  properly version  it.

>
> thanks,
>
> greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] staging : rtl8712: Free memory when kmalloc fails

2016-10-27 Thread Souptick Joarder
There are few functions where we need to free previously allocated memory
when kmalloc fails.Else it may lead to memory leakage.In  _init_cmd_priv()
and _r8712_init_xmit_priv(),in few places we are not freeing previously
allocated memory when kmalloc fails.

Signed-off-by: Souptick joarder 
---
Changes in v2:
 -Make the commit message more cleaner.

 drivers/staging/rtl8712/rtl871x_cmd.c  | 4 +++-
 drivers/staging/rtl8712/rtl871x_xmit.c | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c 
b/drivers/staging/rtl8712/rtl871x_cmd.c
index b7ee5e6..1f284ae 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -72,8 +72,10 @@ static sint _init_cmd_priv(struct cmd_priv *pcmdpriv)
((addr_t)(pcmdpriv->cmd_allocated_buf) &
(CMDBUFF_ALIGN_SZ - 1));
pcmdpriv->rsp_allocated_buf = kmalloc(MAX_RSPSZ + 4, GFP_ATOMIC);
-   if (!pcmdpriv->rsp_allocated_buf)
+   if (!pcmdpriv->rsp_allocated_buf) {
+   kfree(pcmdpriv->cmd_allocated_buf);
+   pcmdpriv->cmd_allocated_buf = NULL;
return _FAIL;
+   }
pcmdpriv->rsp_buf = pcmdpriv->rsp_allocated_buf  +  4 -
((addr_t)(pcmdpriv->rsp_allocated_buf) & 3);
pcmdpriv->cmd_issued_cnt = 0;
diff --git a/drivers/staging/rtl8712/rtl871x_xmit.c 
b/drivers/staging/rtl8712/rtl871x_xmit.c
index be38364..f335161 100644
--- a/drivers/staging/rtl8712/rtl871x_xmit.c
+++ b/drivers/staging/rtl8712/rtl871x_xmit.c
@@ -128,8 +128,10 @@ sint _r8712_init_xmit_priv(struct xmit_priv *pxmitpriv,
_init_queue(&pxmitpriv->pending_xmitbuf_queue);
pxmitpriv->pallocated_xmitbuf = kmalloc(NR_XMITBUFF * sizeof(struct 
xmit_buf) + 4,
GFP_ATOMIC);
-   if (!pxmitpriv->pallocated_xmitbuf)
+   if (!pxmitpriv->pallocated_xmitbuf) {
+   kfree(pxmitpriv->pallocated_frame_buf);
+   pxmitpriv->pallocated_frame_buf = NULL;
return _FAIL;
+   }
pxmitpriv->pxmitbuf = pxmitpriv->pallocated_xmitbuf + 4 -
  ((addr_t)(pxmitpriv->pallocated_xmitbuf) & 3);
pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmitbuf;
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/3] staging: most: hdm-usb: do h/w specific synchronization at configuration time

2016-10-27 Thread Christian Gromm
On Wed, 26 Oct 2016 17:22:50 +0300
Dan Carpenter  wrote:

> On Tue, Oct 25, 2016 at 05:44:20PM +0200, Christian Gromm wrote:
> > From: Andrey Shvetsov 
> > 
> > This patch puts the synchronization procedure trigger for asynchronous
> > channels into the function hdm_configure_channel. Likewise, it removes
> > triggering of hardware specific synchronization for other channel types
> > from the probe function as it is not required.
> > 
> > Signed-off-by: Andrey Shvetsov 
> > Signed-off-by: Christian Gromm 
> > ---
> >  drivers/staging/most/hdm-usb/hdm_usb.c | 17 +
> >  1 file changed, 9 insertions(+), 8 deletions(-)
> > 
> > diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c 
> > b/drivers/staging/most/hdm-usb/hdm_usb.c
> > index 1a630e1..db11930 100644
> > --- a/drivers/staging/most/hdm-usb/hdm_usb.c
> > +++ b/drivers/staging/most/hdm-usb/hdm_usb.c
> > @@ -695,6 +695,15 @@ static int hdm_configure_channel(struct most_interface 
> > *iface, int channel,
> >   - conf->buffer_size;
> >  exit:
> > mdev->conf[channel] = *conf;
> > +   if (conf->data_type == MOST_CH_ASYNC) {
> > +   u16 ep = mdev->ep_address[channel];
> > +   int err = drci_wr_reg(mdev->usb_device,
> > + DRCI_REG_BASE + DRCI_COMMAND + ep * 16,
> > + 1);
> > +
> > +   if (err < 0)
> > +   dev_warn(dev, "sync for ep%02x failed", ep);
> > +   }
> > return 0;
> 
> This code is weird, because we goto exit without checking the
> frame_size.  It looks like it doesn't matter much but it's sort of
> puzzling what's going on.  There weren't any comments to explain it.
> 

The frame size is only needed if we are dealing with synchronous and
(in some cases) isochronous data. So you're right, the variable
frame_size is _not_ needed in case we be jumping to the 'exit' label
and hence, not being checked.

Haven't had the feeling that this is worth a comment. It isn't easy
to decide what needs a comment and what does not anyway. Then I would
probably also have to explain why we jump to 'exit' if we have
isochronous data and a packet_per_transaction value unequal to 0xff.
(I don't expect anyone to understand what this is supposed mean, unless
he is familiar with the network interface controller.)

So, let me know if a comment on the frame_size usage can fix the
confusion.

regards,
Chris

> regards,
> dan carpenter
> 

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/3] staging: most: hdm-usb: do h/w specific synchronization at configuration time

2016-10-27 Thread Dan Carpenter
On Thu, Oct 27, 2016 at 10:57:07AM +0200, Christian Gromm wrote:
> On Wed, 26 Oct 2016 17:22:50 +0300
> Dan Carpenter  wrote:
> 
> > On Tue, Oct 25, 2016 at 05:44:20PM +0200, Christian Gromm wrote:
> > > From: Andrey Shvetsov 
> > > 
> > > This patch puts the synchronization procedure trigger for asynchronous
> > > channels into the function hdm_configure_channel. Likewise, it removes
> > > triggering of hardware specific synchronization for other channel types
> > > from the probe function as it is not required.
> > > 
> > > Signed-off-by: Andrey Shvetsov 
> > > Signed-off-by: Christian Gromm 
> > > ---
> > >  drivers/staging/most/hdm-usb/hdm_usb.c | 17 +
> > >  1 file changed, 9 insertions(+), 8 deletions(-)
> > > 
> > > diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c 
> > > b/drivers/staging/most/hdm-usb/hdm_usb.c
> > > index 1a630e1..db11930 100644
> > > --- a/drivers/staging/most/hdm-usb/hdm_usb.c
> > > +++ b/drivers/staging/most/hdm-usb/hdm_usb.c
> > > @@ -695,6 +695,15 @@ static int hdm_configure_channel(struct 
> > > most_interface *iface, int channel,
> > > - conf->buffer_size;
> > >  exit:
> > >   mdev->conf[channel] = *conf;
> > > + if (conf->data_type == MOST_CH_ASYNC) {
> > > + u16 ep = mdev->ep_address[channel];
> > > + int err = drci_wr_reg(mdev->usb_device,
> > > +   DRCI_REG_BASE + DRCI_COMMAND + ep * 16,
> > > +   1);
> > > +
> > > + if (err < 0)
> > > + dev_warn(dev, "sync for ep%02x failed", ep);
> > > + }
> > >   return 0;
> > 
> > This code is weird, because we goto exit without checking the
> > frame_size.  It looks like it doesn't matter much but it's sort of
> > puzzling what's going on.  There weren't any comments to explain it.
> > 
> 
> The frame size is only needed if we are dealing with synchronous and
> (in some cases) isochronous data. So you're right, the variable
> frame_size is _not_ needed in case we be jumping to the 'exit' label
> and hence, not being checked.
> 
> Haven't had the feeling that this is worth a comment. It isn't easy
> to decide what needs a comment and what does not anyway. Then I would
> probably also have to explain why we jump to 'exit' if we have
> isochronous data and a packet_per_transaction value unequal to 0xff.
> (I don't expect anyone to understand what this is supposed mean, unless
> he is familiar with the network interface controller.)
> 
> So, let me know if a comment on the frame_size usage can fix the
> confusion.

A comment would be nice, yes.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/3] staging: most: hdm-usb: do h/w specific synchronization at configuration time

2016-10-27 Thread Christian Gromm
On Thu, 27 Oct 2016 12:00:28 +0300
Dan Carpenter  wrote:

> On Thu, Oct 27, 2016 at 10:57:07AM +0200, Christian Gromm wrote:
> > On Wed, 26 Oct 2016 17:22:50 +0300
> > Dan Carpenter  wrote:
> > 
> > > On Tue, Oct 25, 2016 at 05:44:20PM +0200, Christian Gromm wrote:
> > > > From: Andrey Shvetsov 
> > > > 
> > > > This patch puts the synchronization procedure trigger for asynchronous
> > > > channels into the function hdm_configure_channel. Likewise, it removes
> > > > triggering of hardware specific synchronization for other channel types
> > > > from the probe function as it is not required.
> > > > 
> > > > Signed-off-by: Andrey Shvetsov 
> > > > Signed-off-by: Christian Gromm 
> > > > ---
> > > >  drivers/staging/most/hdm-usb/hdm_usb.c | 17 +
> > > >  1 file changed, 9 insertions(+), 8 deletions(-)
> > > > 
> > > > diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c 
> > > > b/drivers/staging/most/hdm-usb/hdm_usb.c
> > > > index 1a630e1..db11930 100644
> > > > --- a/drivers/staging/most/hdm-usb/hdm_usb.c
> > > > +++ b/drivers/staging/most/hdm-usb/hdm_usb.c
> > > > @@ -695,6 +695,15 @@ static int hdm_configure_channel(struct 
> > > > most_interface *iface, int channel,
> > > >   - conf->buffer_size;
> > > >  exit:
> > > > mdev->conf[channel] = *conf;
> > > > +   if (conf->data_type == MOST_CH_ASYNC) {
> > > > +   u16 ep = mdev->ep_address[channel];
> > > > +   int err = drci_wr_reg(mdev->usb_device,
> > > > + DRCI_REG_BASE + DRCI_COMMAND + ep 
> > > > * 16,
> > > > + 1);
> > > > +
> > > > +   if (err < 0)
> > > > +   dev_warn(dev, "sync for ep%02x failed", ep);
> > > > +   }
> > > > return 0;
> > > 
> > > This code is weird, because we goto exit without checking the
> > > frame_size.  It looks like it doesn't matter much but it's sort of
> > > puzzling what's going on.  There weren't any comments to explain it.
> > > 
> > 
> > The frame size is only needed if we are dealing with synchronous and
> > (in some cases) isochronous data. So you're right, the variable
> > frame_size is _not_ needed in case we be jumping to the 'exit' label
> > and hence, not being checked.
> > 
> > Haven't had the feeling that this is worth a comment. It isn't easy
> > to decide what needs a comment and what does not anyway. Then I would
> > probably also have to explain why we jump to 'exit' if we have
> > isochronous data and a packet_per_transaction value unequal to 0xff.
> > (I don't expect anyone to understand what this is supposed mean, unless
> > he is familiar with the network interface controller.)
> > 
> > So, let me know if a comment on the frame_size usage can fix the
> > confusion.
> 
> A comment would be nice, yes.

Fine. It would be cool if this patch set will be accepted and I'll be
sending in a new patch that adds the desired comment.

Greg, does this make sense to you?

thanks,
Chris

> 
> regards,
> dan carpenter
> 

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/3] staging: most: hdm-usb: do h/w specific synchronization at configuration time

2016-10-27 Thread Greg KH
On Thu, Oct 27, 2016 at 01:00:47PM +0200, Christian Gromm wrote:
> On Thu, 27 Oct 2016 12:00:28 +0300
> Dan Carpenter  wrote:
> 
> > On Thu, Oct 27, 2016 at 10:57:07AM +0200, Christian Gromm wrote:
> > > On Wed, 26 Oct 2016 17:22:50 +0300
> > > Dan Carpenter  wrote:
> > > 
> > > > On Tue, Oct 25, 2016 at 05:44:20PM +0200, Christian Gromm wrote:
> > > > > From: Andrey Shvetsov 
> > > > > 
> > > > > This patch puts the synchronization procedure trigger for asynchronous
> > > > > channels into the function hdm_configure_channel. Likewise, it removes
> > > > > triggering of hardware specific synchronization for other channel 
> > > > > types
> > > > > from the probe function as it is not required.
> > > > > 
> > > > > Signed-off-by: Andrey Shvetsov 
> > > > > Signed-off-by: Christian Gromm 
> > > > > ---
> > > > >  drivers/staging/most/hdm-usb/hdm_usb.c | 17 +
> > > > >  1 file changed, 9 insertions(+), 8 deletions(-)
> > > > > 
> > > > > diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c 
> > > > > b/drivers/staging/most/hdm-usb/hdm_usb.c
> > > > > index 1a630e1..db11930 100644
> > > > > --- a/drivers/staging/most/hdm-usb/hdm_usb.c
> > > > > +++ b/drivers/staging/most/hdm-usb/hdm_usb.c
> > > > > @@ -695,6 +695,15 @@ static int hdm_configure_channel(struct 
> > > > > most_interface *iface, int channel,
> > > > > - conf->buffer_size;
> > > > >  exit:
> > > > >   mdev->conf[channel] = *conf;
> > > > > + if (conf->data_type == MOST_CH_ASYNC) {
> > > > > + u16 ep = mdev->ep_address[channel];
> > > > > + int err = drci_wr_reg(mdev->usb_device,
> > > > > +   DRCI_REG_BASE + DRCI_COMMAND + ep 
> > > > > * 16,
> > > > > +   1);
> > > > > +
> > > > > + if (err < 0)
> > > > > + dev_warn(dev, "sync for ep%02x failed", ep);
> > > > > + }
> > > > >   return 0;
> > > > 
> > > > This code is weird, because we goto exit without checking the
> > > > frame_size.  It looks like it doesn't matter much but it's sort of
> > > > puzzling what's going on.  There weren't any comments to explain it.
> > > > 
> > > 
> > > The frame size is only needed if we are dealing with synchronous and
> > > (in some cases) isochronous data. So you're right, the variable
> > > frame_size is _not_ needed in case we be jumping to the 'exit' label
> > > and hence, not being checked.
> > > 
> > > Haven't had the feeling that this is worth a comment. It isn't easy
> > > to decide what needs a comment and what does not anyway. Then I would
> > > probably also have to explain why we jump to 'exit' if we have
> > > isochronous data and a packet_per_transaction value unequal to 0xff.
> > > (I don't expect anyone to understand what this is supposed mean, unless
> > > he is familiar with the network interface controller.)
> > > 
> > > So, let me know if a comment on the frame_size usage can fix the
> > > confusion.
> > 
> > A comment would be nice, yes.
> 
> Fine. It would be cool if this patch set will be accepted and I'll be
> sending in a new patch that adds the desired comment.
> 
> Greg, does this make sense to you?

Yes, that's fine.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging :rtl8712: Free memory when kmalloc fails

2016-10-27 Thread Greg KH
On Thu, Oct 27, 2016 at 01:00:01PM +0530, Souptick Joarder wrote:
> On Thu, Oct 27, 2016 at 11:20 AM, Greg KH  wrote:
> > On Thu, Oct 27, 2016 at 11:10:09AM +0530, Souptick Joarder wrote:
> >> There are few functions where we need to free previously allocated memory
> >> when kmalloc fails. Else it may lead to memory leakage.
> >> In  _init_cmd_priv() and _r8712_init_xmit_priv(),in few places we are not
> >> freeing previously allocated memory  when kmalloc fails.
> >
> > Odd use of spaces, can you fix that up?
> >
> >> This patch will address it.
> >
> > That last sentance is not needed.
> 
> Ok, I will do those changes.
> >
> > And isn't this a new version of a patch, or am I mistaken?  If so,
> > please properly version it as SubmittingPatches describes to do.
> 
> This is the new version of previous patch.
> >
> >>
> >> Signed-off-by: Souptick joarder 
> >> ---
> >>  drivers/staging/rtl8712/rtl871x_cmd.c  | 5 -
> >>  drivers/staging/rtl8712/rtl871x_xmit.c | 5 -
> >>  2 files changed, 8 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c 
> >> b/drivers/staging/rtl8712/rtl871x_cmd.c
> >> index b7ee5e6..04638f1 100644
> >> --- a/drivers/staging/rtl8712/rtl871x_cmd.c
> >> +++ b/drivers/staging/rtl8712/rtl871x_cmd.c
> >> @@ -72,8 +72,11 @@ static sint _init_cmd_priv(struct cmd_priv *pcmdpriv)
> >>   ((addr_t)(pcmdpriv->cmd_allocated_buf) &
> >>   (CMDBUFF_ALIGN_SZ - 1));
> >>   pcmdpriv->rsp_allocated_buf = kmalloc(MAX_RSPSZ + 4, GFP_ATOMIC);
> >> - if (!pcmdpriv->rsp_allocated_buf)
> >> + if (!pcmdpriv->rsp_allocated_buf) {
> >> + kfree(pcmdpriv->cmd_allocated_buf);
> >>   return _FAIL;
> >> + }
> >
> > If you need to set the buffer to NULL, please do so, last time I thought
> > you said it was required, is it really not?
> 
> This NULL is required. But I assume, last time you are not agree with it :)
> So I remove it in new version.

I did not say I disagreed, you just had to prove why you were doing
this...

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] staging : rtl8712: Free memory when kmalloc fails

2016-10-27 Thread Greg KH
On Thu, Oct 27, 2016 at 01:46:13PM +0530, Souptick Joarder wrote:
> There are few functions where we need to free previously allocated memory
> when kmalloc fails.Else it may lead to memory leakage.In  _init_cmd_priv()
> and _r8712_init_xmit_priv(),in few places we are not freeing previously
> allocated memory when kmalloc fails.
> 
> Signed-off-by: Souptick joarder 
> ---
> Changes in v2:
>  -Make the commit message more cleaner.

I'll be pedantic here, but please always put a ' ' after a '.' or a ','
It's the copy-editor in me coming out...

You couldn't do something like that on a term-paper and expect to not
get it marked down, right?

another try?

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 1/2] staging: lustre: remove broken dead code in cfs_cpt_table_create_pattern

2016-10-27 Thread Greg Kroah-Hartman
On Tue, Oct 25, 2016 at 11:22:30PM +0200, Arnd Bergmann wrote:
> After a recent bugfix, we get a warning about the use of an uninitialized
> variable:
> 
> drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c: In function 
> 'cfs_cpt_table_create_pattern':
> drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c:833:7: error: 'str' may 
> be used uninitialized in this function [-Werror=maybe-uninitialized]
> 
> This part of the function used to not do anything as we would reassign
> the 'str' pointer to something else right away, but now we pass an
> uninitialized pointer into 'strchr', which can cause a kernel page fault
> or worse.
> 
> Fixes: 239fd5d41f9b ("staging: lustre: libcfs: shortcut to create CPT from 
> NUMA topology")
> Signed-off-by: Arnd Bergmann 
> ---
>  drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c | 7 ---
>  1 file changed, 7 deletions(-)

Hm, I already applied the v1 versions of these, right?  What changed
with these, they seem identical to me...

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 4/5] staging: vc04_services: fix CamelCase

2016-10-27 Thread Greg Kroah-Hartman
On Thu, Oct 27, 2016 at 04:24:31AM +0300, Dan Carpenter wrote:
> On Wed, Oct 26, 2016 at 06:13:13PM -0700, Eric Anholt wrote:
> > Stefan Wahren  writes:
> > 
> > > This fixes the CamelCase of some variables.
> > >
> > > Signed-off-by: Stefan Wahren 
> > 
> > Greg, are these kinds of reformats something that you're looking for in
> > the staging tree?  I'm fine with the patch but I didn't see camel case
> > explicitly called out in CodingStyle after a brief search.
> 
> Yeah.  checkpatch.pl complains and also they look like garbage.
> 
> I wrote a tool to help review these btw.  Just
>   cat patch.txt | rename_rev.pl -a

$ cat ../s1 | perl ./rename_rev.pl
Can't use global $_ in "my" at ./rename_rev.pl line 53, near "my $_ "
Execution of ./rename_rev.pl aborted due to compilation errors.

:(
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 1/2] staging: lustre: remove broken dead code in cfs_cpt_table_create_pattern

2016-10-27 Thread Arnd Bergmann
On Thursday, October 27, 2016 3:12:42 PM CEST Greg Kroah-Hartman wrote:
> On Tue, Oct 25, 2016 at 11:22:30PM +0200, Arnd Bergmann wrote:
> > After a recent bugfix, we get a warning about the use of an uninitialized
> > variable:
> > 
> > drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c: In function 
> > 'cfs_cpt_table_create_pattern':
> > drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c:833:7: error: 'str' 
> > may be used uninitialized in this function [-Werror=maybe-uninitialized]
> > 
> > This part of the function used to not do anything as we would reassign
> > the 'str' pointer to something else right away, but now we pass an
> > uninitialized pointer into 'strchr', which can cause a kernel page fault
> > or worse.
> > 
> > Fixes: 239fd5d41f9b ("staging: lustre: libcfs: shortcut to create CPT from 
> > NUMA topology")
> > Signed-off-by: Arnd Bergmann 
> > ---
> >  drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c | 7 ---
> >  1 file changed, 7 deletions(-)
> 
> Hm, I already applied the v1 versions of these, right?  What changed
> with these, they seem identical to me...

The patches you applied were fine, they just had not made it into linux-next
by Tuesday, and I thought they got lost as I had sent them as part of a longer
series and I screwed up one of the two changelogs initially (you applied the
fixed v2 patch I sent immediately afterwards).

Sorry about the confusion.

Arnd
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] drivers: staging: nvec: remove bogus reset command for PS/2 interface

2016-10-27 Thread Paul Fertser
This command was sent behind serio's back and the answer to it was
confusing atkbd probe function which lead to the elantech touchpad
getting detected as a keyboard.

To prevent this from happening just let every party do its part of the
job.

Signed-off-by: Paul Fertser 
---
 drivers/staging/nvec/nvec_ps2.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/nvec/nvec_ps2.c b/drivers/staging/nvec/nvec_ps2.c
index c83eeb4..910e87b 100644
--- a/drivers/staging/nvec/nvec_ps2.c
+++ b/drivers/staging/nvec/nvec_ps2.c
@@ -106,7 +106,6 @@ static int nvec_mouse_probe(struct platform_device *pdev)
 {
struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent);
struct serio *ser_dev;
-   char mouse_reset[] = { NVEC_PS2, SEND_COMMAND, PSMOUSE_RST, 3 };
 
ser_dev = devm_kzalloc(&pdev->dev, sizeof(struct serio), GFP_KERNEL);
if (!ser_dev)
@@ -127,9 +126,6 @@ static int nvec_mouse_probe(struct platform_device *pdev)
 
serio_register_port(ser_dev);
 
-   /* mouse reset */
-   nvec_write_async(nvec, mouse_reset, sizeof(mouse_reset));
-
return 0;
 }
 
-- 
2.7.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] drivers: staging: nvec: remove bogus reset command for PS/2 interface

2016-10-27 Thread Marc Dietrich
Hi Paul,

thanks for finding the issue!

Am Donnerstag, 27. Oktober 2016, 16:55:14 CEST schrieb Paul Fertser:
> This command was sent behind serio's back and the answer to it was
> confusing atkbd probe function which lead to the elantech touchpad
> getting detected as a keyboard.
> 
> To prevent this from happening just let every party do its part of the
> job.
> 
> Signed-off-by: Paul Fertser 

Please send a complete patch in a new thread (or titled with V2) with the 
serio type change included.

Thanks,

Marc

> ---
>  drivers/staging/nvec/nvec_ps2.c | 4 
>  1 file changed, 4 deletions(-)
> 
> diff --git a/drivers/staging/nvec/nvec_ps2.c
> b/drivers/staging/nvec/nvec_ps2.c index c83eeb4..910e87b 100644
> --- a/drivers/staging/nvec/nvec_ps2.c
> +++ b/drivers/staging/nvec/nvec_ps2.c
> @@ -106,7 +106,6 @@ static int nvec_mouse_probe(struct platform_device
> *pdev) {
>   struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent);
>   struct serio *ser_dev;
> - char mouse_reset[] = { NVEC_PS2, SEND_COMMAND, PSMOUSE_RST, 3 };
> 
>   ser_dev = devm_kzalloc(&pdev->dev, sizeof(struct serio), GFP_KERNEL);
>   if (!ser_dev)
> @@ -127,9 +126,6 @@ static int nvec_mouse_probe(struct platform_device
> *pdev)
> 
>   serio_register_port(ser_dev);
> 
> - /* mouse reset */
> - nvec_write_async(nvec, mouse_reset, sizeof(mouse_reset));
> -
>   return 0;
>  }



signature.asc
Description: This is a digitally signed message part.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 0/2] staging: nvec: ps2: fix touchpad operation

2016-10-27 Thread Paul Fertser
Status quo on Toshiba ac100 (paz00) is that the integrated elantech touchpad is
detected as an ImPS/2 mouse and so it's kind of functional but advanced
synaptics configuration isn't available.

When only serio type is changed it leads to atkbd misdetecting the touchpad as
a keyboard. So first goes the commit that fixes this bug, then the serio type
change.

Paul Fertser (2):
  drivers: staging: nvec: remove bogus reset command for PS/2 interface
  Revert "staging: nvec: ps2: change serio type to passthrough"

 drivers/staging/nvec/nvec_ps2.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

-- 
2.7.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 1/2] drivers: staging: nvec: remove bogus reset command for PS/2 interface

2016-10-27 Thread Paul Fertser
This command was sent behind serio's back and the answer to it was
confusing atkbd probe function which lead to the elantech touchpad
getting detected as a keyboard.

To prevent this from happening just let every party do its part of the
job.

Signed-off-by: Paul Fertser 
---
 drivers/staging/nvec/nvec_ps2.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/nvec/nvec_ps2.c b/drivers/staging/nvec/nvec_ps2.c
index a324322..d63c4ef 100644
--- a/drivers/staging/nvec/nvec_ps2.c
+++ b/drivers/staging/nvec/nvec_ps2.c
@@ -106,7 +106,6 @@ static int nvec_mouse_probe(struct platform_device *pdev)
 {
struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent);
struct serio *ser_dev;
-   char mouse_reset[] = { NVEC_PS2, SEND_COMMAND, PSMOUSE_RST, 3 };
 
ser_dev = devm_kzalloc(&pdev->dev, sizeof(struct serio), GFP_KERNEL);
if (!ser_dev)
@@ -127,9 +126,6 @@ static int nvec_mouse_probe(struct platform_device *pdev)
 
serio_register_port(ser_dev);
 
-   /* mouse reset */
-   nvec_write_async(nvec, mouse_reset, sizeof(mouse_reset));
-
return 0;
 }
 
-- 
2.7.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 2/2] Revert "staging: nvec: ps2: change serio type to passthrough"

2016-10-27 Thread Paul Fertser
This reverts commit 36b30d6138f4677514aca35ab76c20c1604baaad.

This is necessary to detect paz00 (ac100) touchpad properly as one
speaking ETPS/2 protocol. Without it X.org's synaptics driver doesn't
work as the touchpad is detected as an ImPS/2 mouse instead.

Commit ec6184b1c717b8768122e25fe6d312f609cc1bb4 changed the way
auto-detection is performed on ports marked as pass through and made the
issue apparent.

A pass through port is an additional PS/2 port used to connect a slave
device to a master device that is using PS/2 to communicate with the
host (so slave's PS/2 communication is tunneled over master's PS/2
link). "Synaptics PS/2 TouchPad Interfacing Guide" describes such a
setup (PS/2 PASS-THROUGH OPTION section).

Since paz00's embedded controller is not connected to a PS/2 port
itself, the PS/2 interface it exposes is not a pass-through one.

Signed-off-by: Paul Fertser 
---
 drivers/staging/nvec/nvec_ps2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/nvec/nvec_ps2.c b/drivers/staging/nvec/nvec_ps2.c
index d63c4ef..910e87b 100644
--- a/drivers/staging/nvec/nvec_ps2.c
+++ b/drivers/staging/nvec/nvec_ps2.c
@@ -111,7 +111,7 @@ static int nvec_mouse_probe(struct platform_device *pdev)
if (!ser_dev)
return -ENOMEM;
 
-   ser_dev->id.type = SERIO_PS_PSTHRU;
+   ser_dev->id.type = SERIO_8042;
ser_dev->write = ps2_sendcommand;
ser_dev->start = ps2_startstreaming;
ser_dev->stop = ps2_stopstreaming;
-- 
2.7.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 0/2] staging: nvec: ps2: fix touchpad operation

2016-10-27 Thread Marc Dietrich
Am Donnerstag, 27. Oktober 2016, 17:22:07 CEST schrieb Paul Fertser:
> Status quo on Toshiba ac100 (paz00) is that the integrated elantech touchpad
> is detected as an ImPS/2 mouse and so it's kind of functional but advanced
> synaptics configuration isn't available.
> 
> When only serio type is changed it leads to atkbd misdetecting the touchpad
> as a keyboard. So first goes the commit that fixes this bug, then the serio
> type change.
> 
> Paul Fertser (2):
>   drivers: staging: nvec: remove bogus reset command for PS/2 interface
>   Revert "staging: nvec: ps2: change serio type to passthrough"
> 
>  drivers/staging/nvec/nvec_ps2.c | 6 +-
>  1 file changed, 1 insertion(+), 5 deletions(-)

Works fine now. Thanks!

The series is 

Acked-by: Marc Dietrich 



signature.asc
Description: This is a digitally signed message part.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] staging : rtl8712: Free memory when kmalloc fails

2016-10-27 Thread Souptick Joarder
On Thu, Oct 27, 2016 at 6:40 PM, Greg KH  wrote:
> On Thu, Oct 27, 2016 at 01:46:13PM +0530, Souptick Joarder wrote:
>> There are few functions where we need to free previously allocated memory
>> when kmalloc fails.Else it may lead to memory leakage.In  _init_cmd_priv()
>> and _r8712_init_xmit_priv(),in few places we are not freeing previously
>> allocated memory when kmalloc fails.
>>
>> Signed-off-by: Souptick joarder 
>> ---
>> Changes in v2:
>>  -Make the commit message more cleaner.
>
> I'll be pedantic here, but please always put a ' ' after a '.' or a ','

I didn't get which part exactly you are referring.
Are you referring to the patch description and asking me to put  '  '
after a '.'  or  ','

> It's the copy-editor in me coming out...
>
> You couldn't do something like that on a term-paper and expect to not
> get it marked down, right?

My apology here.
>
> another try?
>
> thanks,
>
> greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: comedi: ni_tio: fix buggy ni_tio_clock_period_ps() return value

2016-10-27 Thread Ian Abbott
`ni_tio_clock_period_ps()` used to return the clock period in
picoseconds, and had a `BUG()` call for invalid cases.  It was changed
to pass the clock period back via a pointer parameter and return an
error for the invalid cases.  Unfortunately the code to handle
user-specified clock sources with user-specified clock period is still
returning the clock period the old way, which can lead to the caller not
getting the clock period, or seeing an unexpected error.  Fix it by
passing the clock period via the pointer parameter and returning `0`.

Fixes: b42ca86ad605 ("staging: comedi: ni_tio: remove BUG() checks for 
ni_tio_get_clock_src()")
Signed-off-by: Ian Abbott 
Cc:  # 4.7+
---
 drivers/staging/comedi/drivers/ni_tio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/ni_tio.c 
b/drivers/staging/comedi/drivers/ni_tio.c
index 7043eb0..5ab49a7 100644
--- a/drivers/staging/comedi/drivers/ni_tio.c
+++ b/drivers/staging/comedi/drivers/ni_tio.c
@@ -207,7 +207,8 @@ static int ni_tio_clock_period_ps(const struct ni_gpct 
*counter,
 * clock period is specified by user with prescaling
 * already taken into account.
 */
-   return counter->clock_period_ps;
+   *period_ps = counter->clock_period_ps;
+   return 0;
}
 
switch (generic_clock_source & NI_GPCT_PRESCALE_MODE_CLOCK_SRC_MASK) {
-- 
2.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[driver-core:driver-core-testing 2/6] drivers/base/core.o:(.text.__device_link_del+0x48): undefined reference to `call_srcu'

2016-10-27 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git 
driver-core-testing
head:   ae17f29d0bb84a43b6c5f3e9fac0b124960c53f7
commit: eb6b1b0ba7aa8da0b67bba65764d1258f87b924e [2/6] driver core: Functional 
dependencies tracking support
config: parisc-allnoconfig (attached as .config)
compiler: hppa-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout eb6b1b0ba7aa8da0b67bba65764d1258f87b924e
# save the attached .config to linux build tree
make.cross ARCH=parisc 

All errors (new ones prefixed by >>):

   drivers/built-in.o: In function `__device_link_del':
>> drivers/base/core.o:(.text.__device_link_del+0x48): undefined reference to 
>> `call_srcu'
   drivers/built-in.o: In function `device_links_read_lock':
>> (.text.device_links_read_lock+0x10): undefined reference to 
>> `__srcu_read_lock'
   drivers/built-in.o: In function `device_links_read_unlock':
>> (.text.device_links_read_unlock+0x14): undefined reference to 
>> `__srcu_read_unlock'
   drivers/built-in.o:(.data.rel+0x4c): undefined reference to `process_srcu'

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[driver-core:driver-core-testing 2/6] drivers/built-in.o:undefined reference to `process_srcu'

2016-10-27 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git 
driver-core-testing
head:   ae17f29d0bb84a43b6c5f3e9fac0b124960c53f7
commit: eb6b1b0ba7aa8da0b67bba65764d1258f87b924e [2/6] driver core: Functional 
dependencies tracking support
config: mips-allnoconfig (attached as .config)
compiler: mips-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout eb6b1b0ba7aa8da0b67bba65764d1258f87b924e
# save the attached .config to linux build tree
make.cross ARCH=mips 

All errors (new ones prefixed by >>):

   drivers/built-in.o: In function `__device_link_del':
   core.c:(.text+0x3ae4): undefined reference to `call_srcu'
   drivers/built-in.o: In function `device_links_read_lock':
   (.text+0x3f98): undefined reference to `__srcu_read_lock'
   drivers/built-in.o: In function `device_links_read_unlock':
   (.text+0x3fb4): undefined reference to `__srcu_read_unlock'
>> drivers/built-in.o:(.data+0x3a8): undefined reference to `process_srcu'

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 02/29] staging: lustre: llite: remove IS_ERR(master_inode) check

2016-10-27 Thread James Simmons
The kernel function ilookup5_nowait never returns
IS_ERR so we can remove the IS_ERR check in the
ll_md_blocking_ast() function.

Signed-off-by: James Simmons 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8697
Reviewed-on: http://review.whamcloud.com/23151
Reported-by: Dan Carpenter 
Reviewed-by: Frank Zago 
Reviewed-by: Andreas Dilger 
Reviewed-by: John L. Hammond 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/llite/namei.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/namei.c 
b/drivers/staging/lustre/lustre/llite/namei.c
index a69c8af..9b4095f 100644
--- a/drivers/staging/lustre/lustre/llite/namei.c
+++ b/drivers/staging/lustre/lustre/llite/namei.c
@@ -283,7 +283,7 @@ int ll_md_blocking_ast(struct ldlm_lock *lock, struct 
ldlm_lock_desc *desc,
master_inode = ilookup5(inode->i_sb, hash,
ll_test_inode_by_fid,
(void *)&lli->lli_pfid);
-   if (master_inode && !IS_ERR(master_inode)) {
+   if (master_inode) {

ll_invalidate_negative_children(master_inode);
iput(master_inode);
}
-- 
1.7.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 00/29] Batch one for work from 2.7.55 to 2.7.59

2016-10-27 Thread James Simmons
The first two patches are fixes for problems pointed out by
Dan Carpenter and Julia LaWall. Batch of fixes from the Lustre 2.8
version. Basic support for selinux which before this work
prevented lustre from running. First patch to cleanup lustre_idl.h
which is a uapi header. All these patches are independent of
each other so they can be applied in any order.

Alex Zhuravlev (1):
  staging: lustre: ptlrpc: imp_peer_committed_transno should increase

Amir Shehata (1):
  staging: lustre: ptlrpc: Introduce iovec to bulk descriptor

Andreas Dilger (1):
  staging: lustre: obdclass: variable llog chunk size

Ben Evans (1):
  staging: lustre: headers: Create single .h for lu_seq_range

Bobi Jam (2):
  staging: lustre: llite: restart short read/write for normal IO
  staging: lustre: clio: update file attributes after sync

Gregoire Pichon (2):
  staging: lustre: ptlrpc: embed highest XID in each request
  staging: lustre: mdc: manage number of modify RPCs in flight

Henri Doreau (2):
  staging: lustre: ptlrpc: Forbid too early NRS policy tunings
  staging: lustre: llite: Inform copytool of dataversion changes

Hiroya Nozaki (1):
  staging: lustre: obdclass: race lustre_profile_list

Hongchao Zhang (1):
  staging: lustre: mdt: disable IMA support

James Simmons (2):
  staging: lustre: osc: remove handling cl_avail_grant less than zero
  staging: lustre: llite: remove IS_ERR(master_inode) check

John L. Hammond (2):
  staging: lustre: lov: remove LSM from struct lustre_md
  staging: lustre: llite: add LL_IOC_FUTIMES_3

Lai Siyao (1):
  staging: lustre: dne: setdirstripe should fail if not supported

Niu Yawei (3):
  staging: lustre: ldlm: reclaim granted locks defensively
  staging: lustre: recovery: don't skip open replay on reconnect
  staging: lustre: obdecho: don't copy lu_site

Sebastien Buisson (3):
  staging: lustre: llite: basic support of SELinux in CLIO
  staging: lustre: ptlrpc: do not sleep if encpool reached max capacity
  staging: lustre: ptlrpc: do not switch out-of-date context

wang di (6):
  staging: lustre: lmv: allow cross-MDT rename and link
  staging: lustre: llite: report back to user bad stripe count
  staging: lustre: ptlrpc: Do not resend req with allow_replay
  staging: lustre: mdc: deactive MDT permanently
  staging: lustre: ptlrpc: replay bulk request
  staging: lustre: llog: record the minimum record size

 .../lustre/include/linux/libcfs/libcfs_hash.h  |2 +-
 drivers/staging/lustre/lnet/libcfs/fail.c  |1 +
 drivers/staging/lustre/lnet/libcfs/hash.c  |   24 ++-
 drivers/staging/lustre/lustre/fid/fid_request.c|   18 +-
 drivers/staging/lustre/lustre/fid/lproc_fid.c  |2 +-
 drivers/staging/lustre/lustre/fld/fld_cache.c  |6 +-
 drivers/staging/lustre/lustre/include/cl_object.h  |2 +-
 .../lustre/lustre/include/lustre/lustre_idl.h  |  154 
 .../lustre/lustre/include/lustre/lustre_user.h |   10 +
 drivers/staging/lustre/lustre/include/lustre_fid.h |1 +
 drivers/staging/lustre/lustre/include/lustre_log.h |6 +
 drivers/staging/lustre/lustre/include/lustre_mdc.h |   24 +++
 drivers/staging/lustre/lustre/include/lustre_net.h |  161 +---
 drivers/staging/lustre/lustre/include/lustre_sec.h |2 +
 drivers/staging/lustre/lustre/include/obd.h|9 +-
 drivers/staging/lustre/lustre/include/obd_class.h  |9 +
 .../staging/lustre/lustre/include/obd_support.h|2 +
 drivers/staging/lustre/lustre/include/seq_range.h  |  199 
 drivers/staging/lustre/lustre/ldlm/ldlm_lib.c  |   37 
 drivers/staging/lustre/lustre/ldlm/ldlm_request.c  |4 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_resource.c |8 +-
 drivers/staging/lustre/lustre/llite/Makefile   |6 +-
 drivers/staging/lustre/lustre/llite/dir.c  |   31 +++-
 drivers/staging/lustre/lustre/llite/file.c |  115 
 drivers/staging/lustre/lustre/llite/lcommon_cl.c   |2 +-
 .../staging/lustre/lustre/llite/llite_internal.h   |4 +
 drivers/staging/lustre/lustre/llite/llite_lib.c|   19 +-
 drivers/staging/lustre/lustre/llite/namei.c|   14 +-
 drivers/staging/lustre/lustre/llite/vvp_io.c   |   19 ++-
 drivers/staging/lustre/lustre/llite/xattr.c|   65 +++
 drivers/staging/lustre/lustre/llite/xattr_cache.c  |4 +
 .../staging/lustre/lustre/llite/xattr_security.c   |   88 +
 drivers/staging/lustre/lustre/lmv/lmv_obd.c|   78 ++--
 drivers/staging/lustre/lustre/lov/lov_ea.c |9 +-
 drivers/staging/lustre/lustre/lov/lov_internal.h   |   15 +--
 drivers/staging/lustre/lustre/lov/lov_obd.c|1 -
 drivers/staging/lustre/lustre/lov/lov_object.c |  120 +++-
 drivers/staging/lustre/lustre/lov/lov_pack.c   |  100 --
 drivers/staging/lustre/lustre/mdc/lproc_mdc.c  |   60 ++
 drivers/staging/lustre/lustre/mdc/mdc_locks.c  |   28 ++--
 drivers/staging/lustre/lustre/mdc/mdc_reint.c  |   

[PATCH 19/29] staging: lustre: ldlm: reclaim granted locks defensively

2016-10-27 Thread James Simmons
From: Niu Yawei 

It was discovered that to many ldlm locks where being
created on the server side to the point of memory
exhaustion. The work of LU-6529 introduced watermarks
to avoid this memory exhaustion. This is the client
side part of this work for the upstream client.

Signed-off-by: Niu Yawei 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6529
Reviewed-on: http://review.whamcloud.com/14931
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6929
Reviewed-on: http://review.whamcloud.com/15813
Reviewed-by: Andreas Dilger 
Reviewed-by: Bobi Jam 
Reviewed-by: Lai Siyao 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 .../lustre/include/linux/libcfs/libcfs_hash.h  |2 +-
 drivers/staging/lustre/lnet/libcfs/hash.c  |   24 +++-
 drivers/staging/lustre/lustre/ldlm/ldlm_request.c  |4 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_resource.c |8 --
 drivers/staging/lustre/lustre/mdc/mdc_locks.c  |   15 
 5 files changed, 31 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h 
b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h
index 6949a18..f2b4399 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h
@@ -705,7 +705,7 @@ typedef int (*cfs_hash_for_each_cb_t)(struct cfs_hash *hs,
 cfs_hash_for_each_safe(struct cfs_hash *hs, cfs_hash_for_each_cb_t, void 
*data);
 int
 cfs_hash_for_each_nolock(struct cfs_hash *hs, cfs_hash_for_each_cb_t,
-void *data);
+void *data, int start);
 int
 cfs_hash_for_each_empty(struct cfs_hash *hs, cfs_hash_for_each_cb_t,
void *data);
diff --git a/drivers/staging/lustre/lnet/libcfs/hash.c 
b/drivers/staging/lustre/lnet/libcfs/hash.c
index 23283b6..997b8a5 100644
--- a/drivers/staging/lustre/lnet/libcfs/hash.c
+++ b/drivers/staging/lustre/lnet/libcfs/hash.c
@@ -1552,7 +1552,7 @@ struct cfs_hash_cond_arg {
  */
 static int
 cfs_hash_for_each_relax(struct cfs_hash *hs, cfs_hash_for_each_cb_t func,
-   void *data)
+   void *data, int start)
 {
struct hlist_node *hnode;
struct hlist_node *tmp;
@@ -1560,18 +1560,25 @@ struct cfs_hash_cond_arg {
__u32 version;
int count = 0;
int stop_on_change;
-   int rc;
+   int end = -1;
+   int rc = 0;
int i;
 
stop_on_change = cfs_hash_with_rehash_key(hs) ||
 !cfs_hash_with_no_itemref(hs) ||
 !hs->hs_ops->hs_put_locked;
cfs_hash_lock(hs, 0);
+again:
LASSERT(!cfs_hash_is_rehashing(hs));
 
cfs_hash_for_each_bucket(hs, &bd, i) {
struct hlist_head *hhead;
 
+   if (i < start)
+   continue;
+   else if (end > 0 && i >= end)
+   break;
+
cfs_hash_bd_lock(hs, &bd, 0);
version = cfs_hash_bd_version_get(&bd);
 
@@ -1611,14 +1618,19 @@ struct cfs_hash_cond_arg {
if (rc) /* callback wants to break iteration */
break;
}
-   cfs_hash_unlock(hs, 0);
+   if (start > 0 && !rc) {
+   end = start;
+   start = 0;
+   goto again;
+   }
 
+   cfs_hash_unlock(hs, 0);
return count;
 }
 
 int
 cfs_hash_for_each_nolock(struct cfs_hash *hs, cfs_hash_for_each_cb_t func,
-void *data)
+void *data, int start)
 {
if (cfs_hash_with_no_lock(hs) ||
cfs_hash_with_rehash_key(hs) ||
@@ -1630,7 +1642,7 @@ struct cfs_hash_cond_arg {
return -EOPNOTSUPP;
 
cfs_hash_for_each_enter(hs);
-   cfs_hash_for_each_relax(hs, func, data);
+   cfs_hash_for_each_relax(hs, func, data, start);
cfs_hash_for_each_exit(hs);
 
return 0;
@@ -1662,7 +1674,7 @@ struct cfs_hash_cond_arg {
return -EOPNOTSUPP;
 
cfs_hash_for_each_enter(hs);
-   while (cfs_hash_for_each_relax(hs, func, data)) {
+   while (cfs_hash_for_each_relax(hs, func, data, 0)) {
CDEBUG(D_INFO, "Try to empty hash: %s, loop: %u\n",
   hs->hs_name, i++);
}
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c 
b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c
index ac1927c..43856ff 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c
@@ -1729,7 +1729,7 @@ int ldlm_cli_cancel_unused(struct ldlm_namespace *ns,
   opaque);
} else {
cfs_hash_for_each_nolock(ns->ns_rs_hash,
-ldlm_cli_hash_cancel_unused, &arg);
+ldlm_cli_hash_cancel_unused, &arg, 0);
 

[PATCH 09/29] staging: lustre: dne: setdirstripe should fail if not supported

2016-10-27 Thread James Simmons
From: Lai Siyao 

If MDS doesn't support striped directory, creating striped directory
from a userland utility such as 'lfs setdirstripe' should fail.

Signed-off-by: Lai Siyao 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6661
Reviewed-on: http://review.whamcloud.com/15123
Reviewed-by: James Simmons 
Reviewed-by: Andreas Dilger 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/llite/dir.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/dir.c 
b/drivers/staging/lustre/lustre/llite/dir.c
index 929c32c..6e744a5 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -419,6 +419,10 @@ static int ll_dir_setdirstripe(struct inode *parent, 
struct lmv_user_md *lump,
   PFID(ll_inode2fid(parent)), parent, dirname,
   (int)lump->lum_stripe_offset, lump->lum_stripe_count);
 
+   if (lump->lum_stripe_count > 1 &&
+   !(exp_connect_flags(sbi->ll_md_exp) & OBD_CONNECT_DIR_STRIPE))
+   return -EINVAL;
+
if (lump->lum_magic != cpu_to_le32(LMV_USER_MAGIC))
lustre_swab_lmv_user_md(lump);
 
-- 
1.7.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 03/29] staging: lustre: llite: restart short read/write for normal IO

2016-10-27 Thread James Simmons
From: Bobi Jam 

If normal IO got short read/write, we'd restart the IO from where
we've accomplished until we meet EOF or error happens.

Signed-off-by: Bobi Jam 
Signed-off-by: Jinshan Xiong 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6389
Reviewed-on: http://review.whamcloud.com/14123
Reviewed-by: Andreas Dilger 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lnet/libcfs/fail.c  |1 +
 .../staging/lustre/lustre/include/obd_support.h|2 +
 drivers/staging/lustre/lustre/llite/file.c |   41 
 drivers/staging/lustre/lustre/llite/vvp_io.c   |   19 -
 4 files changed, 45 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/lustre/lnet/libcfs/fail.c 
b/drivers/staging/lustre/lnet/libcfs/fail.c
index e4b1a0a..3a9c8dd 100644
--- a/drivers/staging/lustre/lnet/libcfs/fail.c
+++ b/drivers/staging/lustre/lnet/libcfs/fail.c
@@ -113,6 +113,7 @@ int __cfs_fail_check_set(__u32 id, __u32 value, int set)
break;
case CFS_FAIL_LOC_RESET:
cfs_fail_loc = value;
+   atomic_set(&cfs_fail_count, 0);
break;
default:
LASSERTF(0, "called with bad set %u\n", set);
diff --git a/drivers/staging/lustre/lustre/include/obd_support.h 
b/drivers/staging/lustre/lustre/include/obd_support.h
index 1233c34..7f3f8cd 100644
--- a/drivers/staging/lustre/lustre/include/obd_support.h
+++ b/drivers/staging/lustre/lustre/include/obd_support.h
@@ -458,6 +458,8 @@
 #define OBD_FAIL_LOV_INIT  0x1403
 #define OBD_FAIL_GLIMPSE_DELAY 0x1404
 #define OBD_FAIL_LLITE_XATTR_ENOMEM0x1405
+#define OBD_FAIL_MAKE_LOVEA_HOLE   0x1406
+#define OBD_FAIL_LLITE_LOST_LAYOUT 0x1407
 #define OBD_FAIL_GETATTR_DELAY 0x1409
 
 #define OBD_FAIL_FID_INDIR 0x1501
diff --git a/drivers/staging/lustre/lustre/llite/file.c 
b/drivers/staging/lustre/lustre/llite/file.c
index 0accf28..2c8df43 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -972,9 +972,11 @@ void ll_io_init(struct cl_io *io, const struct file *file, 
int write)
 {
struct ll_inode_info *lli = ll_i2info(file_inode(file));
struct ll_file_data  *fd  = LUSTRE_FPRIVATE(file);
+   struct vvp_io *vio = vvp_env_io(env);
struct range_lock range;
struct cl_io *io;
-   ssize_tresult;
+   ssize_t result = 0;
+   int rc = 0;
 
CDEBUG(D_VFSTRACE, "file: %pD, type: %d ppos: %llu, count: %zu\n",
   file, iot, *ppos, count);
@@ -1006,16 +1008,15 @@ void ll_io_init(struct cl_io *io, const struct file 
*file, int write)
CDEBUG(D_VFSTRACE, "Range lock [%llu, %llu]\n",
   range.rl_node.in_extent.start,
   range.rl_node.in_extent.end);
-   result = range_lock(&lli->lli_write_tree,
-   &range);
-   if (result < 0)
+   rc = range_lock(&lli->lli_write_tree, &range);
+   if (rc < 0)
goto out;
 
range_locked = true;
}
down_read(&lli->lli_trunc_sem);
ll_cl_add(file, env, io);
-   result = cl_io_loop(env, io);
+   rc = cl_io_loop(env, io);
ll_cl_remove(file, env);
up_read(&lli->lli_trunc_sem);
if (range_locked) {
@@ -1026,24 +1027,26 @@ void ll_io_init(struct cl_io *io, const struct file 
*file, int write)
}
} else {
/* cl_io_rw_init() handled IO */
-   result = io->ci_result;
+   rc = io->ci_result;
}
 
if (io->ci_nob > 0) {
result = io->ci_nob;
+   count -= io->ci_nob;
*ppos = io->u.ci_wr.wr.crw_pos;
+
+   /* prepare IO restart */
+   if (count > 0)
+   args->u.normal.via_iter = vio->vui_iter;
}
-   goto out;
 out:
cl_io_fini(env, io);
-   /* If any bit been read/written (result != 0), we just return
-* short read/write instead of restart io.
-*/
-   if ((result == 0 || result == -ENODATA) && io->ci_need_restart) {
-   CDEBUG(D_VFSTRACE, "Restart %s on %pD from %lld, count:%zu\n",
+
+   if ((!rc || rc == -ENODATA) && count > 0 && io->ci_need_restart) {
+   CDEBUG(D_VFSTRACE, "%s: restart %s from %lld, count:%zu, 
result: %zd\n",
+  file_dentry(file)->d_name.name,
   iot == CIT_READ ? "read" : "write",
-  file, *ppos, count);
-   LASSERTF(io->ci_nob == 0, "%zd\n", io->ci_nob);
+  *ppos, count, result);

[PATCH 12/29] staging: lustre: mdc: manage number of modify RPCs in flight

2016-10-27 Thread James Simmons
From: Gregoire Pichon 

This patch is the main client part of a new feature that supports
multiple modify metadata RPCs in parallel. Its goal is to improve
metadata operations performance of a single client, while maintening
the consistency of MDT reply reconstruction and MDT recovery
mechanisms.

It allows to manage the number of modify RPCs in flight within
the client obd structure and to assign a virtual index (the tag) to
each modify RPC to help server side cleaning of reply data.

The mdc component uses this feature to send multiple modify RPCs
in parallel.

Signed-off-by: Gregoire Pichon 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5319
Reviewed-on: http://review.whamcloud.com/14374
Reviewed-by: Andreas Dilger 
Reviewed-by: Alex Zhuravlev 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/fid/fid_request.c|4 -
 drivers/staging/lustre/lustre/include/lustre_mdc.h |   24 +++
 drivers/staging/lustre/lustre/include/obd.h|7 +-
 drivers/staging/lustre/lustre/include/obd_class.h  |6 +
 drivers/staging/lustre/lustre/ldlm/ldlm_lib.c  |   37 +
 drivers/staging/lustre/lustre/mdc/lproc_mdc.c  |   23 +++
 drivers/staging/lustre/lustre/mdc/mdc_locks.c  |   13 +-
 drivers/staging/lustre/lustre/mdc/mdc_reint.c  |   23 +--
 drivers/staging/lustre/lustre/mdc/mdc_request.c|   50 ++-
 drivers/staging/lustre/lustre/obdclass/genops.c|  171 +++-
 10 files changed, 293 insertions(+), 65 deletions(-)

diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c 
b/drivers/staging/lustre/lustre/fid/fid_request.c
index edd72b9..dfef3ca 100644
--- a/drivers/staging/lustre/lustre/fid/fid_request.c
+++ b/drivers/staging/lustre/lustre/fid/fid_request.c
@@ -112,11 +112,7 @@ static int seq_client_rpc(struct lu_client_seq *seq,
 
ptlrpc_at_set_req_timeout(req);
 
-   if (opc != SEQ_ALLOC_SUPER && seq->lcs_type == LUSTRE_SEQ_METADATA)
-   mdc_get_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL);
rc = ptlrpc_queue_wait(req);
-   if (opc != SEQ_ALLOC_SUPER && seq->lcs_type == LUSTRE_SEQ_METADATA)
-   mdc_put_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL);
if (rc)
goto out_req;
 
diff --git a/drivers/staging/lustre/lustre/include/lustre_mdc.h 
b/drivers/staging/lustre/lustre/include/lustre_mdc.h
index 92a5c0f..198ceb0 100644
--- a/drivers/staging/lustre/lustre/include/lustre_mdc.h
+++ b/drivers/staging/lustre/lustre/include/lustre_mdc.h
@@ -156,6 +156,30 @@ static inline void mdc_put_rpc_lock(struct mdc_rpc_lock 
*lck,
mutex_unlock(&lck->rpcl_mutex);
 }
 
+static inline void mdc_get_mod_rpc_slot(struct ptlrpc_request *req,
+   struct lookup_intent *it)
+{
+   struct client_obd *cli = &req->rq_import->imp_obd->u.cli;
+   u32 opc;
+   u16 tag;
+
+   opc = lustre_msg_get_opc(req->rq_reqmsg);
+   tag = obd_get_mod_rpc_slot(cli, opc, it);
+   lustre_msg_set_tag(req->rq_reqmsg, tag);
+}
+
+static inline void mdc_put_mod_rpc_slot(struct ptlrpc_request *req,
+   struct lookup_intent *it)
+{
+   struct client_obd *cli = &req->rq_import->imp_obd->u.cli;
+   u32 opc;
+   u16 tag;
+
+   opc = lustre_msg_get_opc(req->rq_reqmsg);
+   tag = lustre_msg_get_tag(req->rq_reqmsg);
+   obd_put_mod_rpc_slot(cli, opc, it, tag);
+}
+
 /**
  * Update the maximum possible easize.
  *
diff --git a/drivers/staging/lustre/lustre/include/obd.h 
b/drivers/staging/lustre/lustre/include/obd.h
index c8a6e23..09e3e71 100644
--- a/drivers/staging/lustre/lustre/include/obd.h
+++ b/drivers/staging/lustre/lustre/include/obd.h
@@ -263,14 +263,17 @@ struct client_obd {
wait_queue_head_t cl_destroy_waitq;
 
struct mdc_rpc_lock *cl_rpc_lock;
-   struct mdc_rpc_lock *cl_close_lock;
 
/* modify rpcs in flight
 * currently used for metadata only
 */
spinlock_t   cl_mod_rpcs_lock;
u16  cl_max_mod_rpcs_in_flight;
-
+   u16  cl_mod_rpcs_in_flight;
+   u16  cl_close_rpcs_in_flight;
+   wait_queue_head_tcl_mod_rpcs_waitq;
+   unsigned long   *cl_mod_tag_bitmap;
+   struct obd_histogram cl_mod_rpcs_hist;
 
/* mgc datastruct */
atomic_t cl_mgc_refcount;
diff --git a/drivers/staging/lustre/lustre/include/obd_class.h 
b/drivers/staging/lustre/lustre/include/obd_class.h
index aba96c3..476b1e4 100644
--- a/drivers/staging/lustre/lustre/include/obd_class.h
+++ b/drivers/staging/lustre/lustre/include/obd_class.h
@@ -101,6 +101,12 @@ struct obd_device *class_devices_in_group(struct obd_uuid 
*grp_uuid,
 __u32 obd_get_max_rpcs_in_flight(struct client_obd *cli);
 int obd_set_max_rpcs_in_flight(struct client_obd *cli, __u32 max);
 int obd_set_max_mod_rpcs_in_flight(stru

[PATCH 06/29] staging: lustre: ptlrpc: Introduce iovec to bulk descriptor

2016-10-27 Thread James Simmons
From: Amir Shehata 

Added a union to ptlrpc_bulk_desc for KVEC and KIOV buffers.
bd_type has been changed to be a bit mask. Bits are set in
bd_type to specify {put,get}{source,sink}{kvec,kiov}
changed all instances in the code to access the union properly
ASSUMPTION: all current code only works with KIOV and new DNE code
to be added will introduce a different code path that uses IOVEC

As part of the implementation buffer operations are added
as callbacks to be defined by users of ptlrpc.  This enables
buffer users to define how to allocate and release buffers.

Signed-off-by: Amir Shehata 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5835
Reviewed-on: http://review.whamcloud.com/12525
Reviewed-by: wangdi 
Reviewed-by: Liang Zhen 
Reviewed-by: James Simmons 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/include/lustre_net.h |  160 ---
 drivers/staging/lustre/lustre/mdc/mdc_request.c|8 +-
 drivers/staging/lustre/lustre/mgc/mgc_request.c|8 +-
 drivers/staging/lustre/lustre/osc/osc_page.c   |4 +-
 drivers/staging/lustre/lustre/osc/osc_request.c|7 +-
 drivers/staging/lustre/lustre/ptlrpc/client.c  |  121 +++
 drivers/staging/lustre/lustre/ptlrpc/events.c  |4 +-
 drivers/staging/lustre/lustre/ptlrpc/niobuf.c  |7 +-
 drivers/staging/lustre/lustre/ptlrpc/pers.c|   31 ++--
 .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h |9 +-
 drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c|   19 ++-
 drivers/staging/lustre/lustre/ptlrpc/sec_plain.c   |   20 ++-
 12 files changed, 290 insertions(+), 108 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h 
b/drivers/staging/lustre/lustre/include/lustre_net.h
index 7302238..67a7095 100644
--- a/drivers/staging/lustre/lustre/include/lustre_net.h
+++ b/drivers/staging/lustre/lustre/include/lustre_net.h
@@ -50,6 +50,7 @@
  * @{
  */
 
+#include 
 #include "../../include/linux/libcfs/libcfs.h"
 #include "../../include/linux/lnet/nidstr.h"
 #include "../../include/linux/lnet/api.h"
@@ -1083,10 +1084,93 @@ struct ptlrpc_bulk_page {
struct page *bp_page;
 };
 
-#define BULK_GET_SOURCE   0
-#define BULK_PUT_SINK 1
-#define BULK_GET_SINK 2
-#define BULK_PUT_SOURCE   3
+enum ptlrpc_bulk_op_type {
+   PTLRPC_BULK_OP_ACTIVE   = 0x0001,
+   PTLRPC_BULK_OP_PASSIVE  = 0x0002,
+   PTLRPC_BULK_OP_PUT  = 0x0004,
+   PTLRPC_BULK_OP_GET  = 0x0008,
+   PTLRPC_BULK_BUF_KVEC= 0x0010,
+   PTLRPC_BULK_BUF_KIOV= 0x0020,
+   PTLRPC_BULK_GET_SOURCE  = PTLRPC_BULK_OP_PASSIVE | PTLRPC_BULK_OP_GET,
+   PTLRPC_BULK_PUT_SINK= PTLRPC_BULK_OP_PASSIVE | PTLRPC_BULK_OP_PUT,
+   PTLRPC_BULK_GET_SINK= PTLRPC_BULK_OP_ACTIVE | PTLRPC_BULK_OP_GET,
+   PTLRPC_BULK_PUT_SOURCE  = PTLRPC_BULK_OP_ACTIVE | PTLRPC_BULK_OP_PUT,
+};
+
+static inline bool ptlrpc_is_bulk_op_get(enum ptlrpc_bulk_op_type type)
+{
+   return (type & PTLRPC_BULK_OP_GET) == PTLRPC_BULK_OP_GET;
+}
+
+static inline bool ptlrpc_is_bulk_get_source(enum ptlrpc_bulk_op_type type)
+{
+   return (type & PTLRPC_BULK_GET_SOURCE) == PTLRPC_BULK_GET_SOURCE;
+}
+
+static inline bool ptlrpc_is_bulk_put_sink(enum ptlrpc_bulk_op_type type)
+{
+   return (type & PTLRPC_BULK_PUT_SINK) == PTLRPC_BULK_PUT_SINK;
+}
+
+static inline bool ptlrpc_is_bulk_get_sink(enum ptlrpc_bulk_op_type type)
+{
+   return (type & PTLRPC_BULK_GET_SINK) == PTLRPC_BULK_GET_SINK;
+}
+
+static inline bool ptlrpc_is_bulk_put_source(enum ptlrpc_bulk_op_type type)
+{
+   return (type & PTLRPC_BULK_PUT_SOURCE) == PTLRPC_BULK_PUT_SOURCE;
+}
+
+static inline bool ptlrpc_is_bulk_desc_kvec(enum ptlrpc_bulk_op_type type)
+{
+   return ((type & PTLRPC_BULK_BUF_KVEC) | (type & PTLRPC_BULK_BUF_KIOV))
+   == PTLRPC_BULK_BUF_KVEC;
+}
+
+static inline bool ptlrpc_is_bulk_desc_kiov(enum ptlrpc_bulk_op_type type)
+{
+   return ((type & PTLRPC_BULK_BUF_KVEC) | (type & PTLRPC_BULK_BUF_KIOV))
+   == PTLRPC_BULK_BUF_KIOV;
+}
+
+static inline bool ptlrpc_is_bulk_op_active(enum ptlrpc_bulk_op_type type)
+{
+   return ((type & PTLRPC_BULK_OP_ACTIVE) |
+   (type & PTLRPC_BULK_OP_PASSIVE)) == PTLRPC_BULK_OP_ACTIVE;
+}
+
+static inline bool ptlrpc_is_bulk_op_passive(enum ptlrpc_bulk_op_type type)
+{
+   return ((type & PTLRPC_BULK_OP_ACTIVE) |
+   (type & PTLRPC_BULK_OP_PASSIVE)) == PTLRPC_BULK_OP_PASSIVE;
+}
+
+struct ptlrpc_bulk_frag_ops {
+   /**
+* Add a page \a page to the bulk descriptor \a desc
+* Data to transfer in the page starts at offset \a pageoffset and
+* amount of data to transfer from the page is \a len
+*/
+   void (*add_kiov_frag)(struct ptlrpc_bulk_desc *desc,
+ struct page *page, int pageoffset, int len);
+
+   /*
+* Add a \a fragment to the bulk descriptor \a de

[PATCH 05/29] staging: lustre: lmv: allow cross-MDT rename and link

2016-10-27 Thread James Simmons
From: wang di 

Remove checks for cross-MDT operation, so cross-MDT
rename and link will be allowed.

Remove obsolete locality parameters in MDT lock API after all of
cross-MDT operations are allowed.

This is the client side changed only so the upstream
client can support this.

Signed-off-by: wang di 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3537
Reviewed-on: http://review.whamcloud.com/12282
Reviewed-by: James Simmons 
Reviewed-by: Lai Siyao 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/lmv/lmv_obd.c |   77 ---
 1 files changed, 57 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c 
b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
index 679cd87..7a8d1c8 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
@@ -1903,7 +1903,10 @@ static int lmv_rename(struct obd_export *exp, struct 
md_op_data *op_data,
 {
struct obd_device   *obd = exp->exp_obd;
struct lmv_obd*lmv = &obd->u.lmv;
+   struct obd_export *target_exp;
struct lmv_tgt_desc *src_tgt;
+   struct lmv_tgt_desc *tgt_tgt;
+   struct mdt_body *body;
int rc;
 
LASSERT(oldlen != 0);
@@ -1943,6 +1946,10 @@ static int lmv_rename(struct obd_export *exp, struct 
md_op_data *op_data,
if (rc)
return rc;
src_tgt = lmv_find_target(lmv, &op_data->op_fid3);
+   if (IS_ERR(src_tgt))
+   return PTR_ERR(src_tgt);
+
+   target_exp = src_tgt->ltd_exp;
} else {
if (op_data->op_mea1) {
struct lmv_stripe_md *lsm = op_data->op_mea1;
@@ -1951,29 +1958,27 @@ static int lmv_rename(struct obd_export *exp, struct 
md_op_data *op_data,
 oldlen,
 &op_data->op_fid1,
 &op_data->op_mds);
-   if (IS_ERR(src_tgt))
-   return PTR_ERR(src_tgt);
} else {
src_tgt = lmv_find_target(lmv, &op_data->op_fid1);
-   if (IS_ERR(src_tgt))
-   return PTR_ERR(src_tgt);
-
-   op_data->op_mds = src_tgt->ltd_idx;
}
+   if (IS_ERR(src_tgt))
+   return PTR_ERR(src_tgt);
 
if (op_data->op_mea2) {
struct lmv_stripe_md *lsm = op_data->op_mea2;
-   const struct lmv_oinfo *oinfo;
 
-   oinfo = lsm_name_to_stripe_info(lsm, new, newlen);
-   if (IS_ERR(oinfo))
-   return PTR_ERR(oinfo);
-
-   op_data->op_fid2 = oinfo->lmo_fid;
+   tgt_tgt = lmv_locate_target_for_name(lmv, lsm, new,
+newlen,
+&op_data->op_fid2,
+&op_data->op_mds);
+   } else {
+   tgt_tgt = lmv_find_target(lmv, &op_data->op_fid2);
}
+   if (IS_ERR(tgt_tgt))
+   return PTR_ERR(tgt_tgt);
+
+   target_exp = tgt_tgt->ltd_exp;
}
-   if (IS_ERR(src_tgt))
-   return PTR_ERR(src_tgt);
 
/*
 * LOOKUP lock on src child (fid3) should also be cancelled for
@@ -2014,20 +2019,52 @@ static int lmv_rename(struct obd_export *exp, struct 
md_op_data *op_data,
return rc;
}
 
+retry_rename:
/*
 * Cancel all the locks on tgt child (fid4).
 */
-   if (fid_is_sane(&op_data->op_fid4))
+   if (fid_is_sane(&op_data->op_fid4)) {
+   struct lmv_tgt_desc *tgt;
+
rc = lmv_early_cancel(exp, NULL, op_data, src_tgt->ltd_idx,
  LCK_EX, MDS_INODELOCK_FULL,
  MF_MDC_CANCEL_FID4);
+   if (rc)
+   return rc;
 
-   CDEBUG(D_INODE, DFID":m%d to "DFID"\n", PFID(&op_data->op_fid1),
-  op_data->op_mds, PFID(&op_data->op_fid2));
+   tgt = lmv_find_target(lmv, &op_data->op_fid4);
+   if (IS_ERR(tgt))
+   return PTR_ERR(tgt);
 
-   rc = md_rename(src_tgt->ltd_exp, op_data, old, oldlen,
-  new, newlen, request);
-   return rc;
+   /*
+* Since the target child might be destroyed, and it might
+* become orphan, and we can only check orphan on the local
+* MDT right now, so we send rename request to the MDT where
+

[PATCH 17/29] staging: lustre: ptlrpc: replay bulk request

2016-10-27 Thread James Simmons
From: wang di 

Even though the server might already got the bulk
replay request, but bulk transfer timeout, let's
replay the bulk request, i.e. treat such replay as
same as no replied replay request (See
ptlrpc_replay_interpret()).

Signed-off-by: wang di 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6924
Reviewed-on: http://review.whamcloud.com/15793
Reviewed-by: Alex Zhuravlev 
Reviewed-by: Niu Yawei 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/ptlrpc/client.c |   11 +--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c 
b/drivers/staging/lustre/lustre/ptlrpc/client.c
index e4fbdd0..bda925e 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/client.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/client.c
@@ -2762,8 +2762,15 @@ static int ptlrpc_replay_interpret(const struct lu_env 
*env,
 
atomic_dec(&imp->imp_replay_inflight);
 
-   if (!ptlrpc_client_replied(req)) {
-   CERROR("request replay timed out, restarting recovery\n");
+   /*
+* Note: if it is bulk replay (MDS-MDS replay), then even if
+* server got the request, but bulk transfer timeout, let's
+* replay the bulk req again
+*/
+   if (!ptlrpc_client_replied(req) ||
+   (req->rq_bulk &&
+lustre_msg_get_status(req->rq_repmsg) == -ETIMEDOUT)) {
+   DEBUG_REQ(D_ERROR, req, "request replay timed out.\n");
rc = -ETIMEDOUT;
goto out;
}
-- 
1.7.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 01/29] staging: lustre: osc: remove handling cl_avail_grant less than zero

2016-10-27 Thread James Simmons
Earlier cl_avail_grant was changed to an unsigned int. Juila
Lawall reported for the upstream client the following which
affects the Intel branch as well:

drivers/staging/lustre/lustre/osc/osc_request.c:1045:5-24: WARNING: Unsigned
expression compared with zero: cli -> cl_avail_grant < 0

Since cl_avail_grant can never be negative we can remove the
code handling the negative value case.

Signed-off-by: James Simmons 
Intel-bug-id: LU-8697 https://jira.hpdd.intel.com/browse/LU-6303
Reviewed-on: http://review.whamcloud.com/23155
Reviewed-by: Fan Yong 
Reviewed-by: Frank Zago 
Reviewed-by: John L. Hammond 
Reviewed-by: Dmitry Eremin 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/osc/osc_request.c |   10 --
 1 files changed, 0 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c 
b/drivers/staging/lustre/lustre/osc/osc_request.c
index 038f00c..efd938a 100644
--- a/drivers/staging/lustre/lustre/osc/osc_request.c
+++ b/drivers/staging/lustre/lustre/osc/osc_request.c
@@ -801,16 +801,6 @@ static void osc_init_grant(struct client_obd *cli, struct 
obd_connect_data *ocd)
cli->cl_avail_grant = ocd->ocd_grant -
  (cli->cl_dirty_pages << PAGE_SHIFT);
 
-   if (cli->cl_avail_grant < 0) {
-   CWARN("%s: available grant < 0: avail/ocd/dirty %ld/%u/%ld\n",
- cli->cl_import->imp_obd->obd_name, cli->cl_avail_grant,
- ocd->ocd_grant, cli->cl_dirty_pages << PAGE_SHIFT);
-   /* workaround for servers which do not have the patch from
-* LU-2679
-*/
-   cli->cl_avail_grant = ocd->ocd_grant;
-   }
-
/* determine the appropriate chunk size used by osc_extent. */
cli->cl_chunkbits = max_t(int, PAGE_SHIFT, ocd->ocd_blocksize);
spin_unlock(&cli->cl_loi_list_lock);
-- 
1.7.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 13/29] staging: lustre: llite: report back to user bad stripe count

2016-10-27 Thread James Simmons
From: wang di 

If the user is requesting a stripe count larger than what
is supported in the file system then report back to the
user an error as well as what is the largest possible
striping.

Signed-off-by: wang di 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6602
Reviewed-on: http://review.whamcloud.com/15162
Reviewed-by: Andreas Dilger 
Reviewed-by: James Simmons 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/llite/dir.c |   12 
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/dir.c 
b/drivers/staging/lustre/lustre/llite/dir.c
index fb367ae..64a32d5 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -1195,6 +1195,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int 
cmd, unsigned long arg)
struct lmv_user_md *tmp = NULL;
union lmv_mds_md *lmm = NULL;
u64 valid = 0;
+   int max_stripe_count;
int stripe_count;
int mdt_index;
int lum_size;
@@ -1206,6 +1207,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int 
cmd, unsigned long arg)
if (copy_from_user(&lum, ulmv, sizeof(*ulmv)))
return -EFAULT;
 
+   max_stripe_count = lum.lum_stripe_count;
/*
 * lum_magic will indicate which stripe the ioctl will like
 * to get, LMV_MAGIC_V1 is for normal LMV stripe, LMV_USER_MAGIC
@@ -1240,6 +1242,16 @@ static long ll_dir_ioctl(struct file *file, unsigned int 
cmd, unsigned long arg)
}
 
stripe_count = lmv_mds_md_stripe_count_get(lmm);
+   if (max_stripe_count < stripe_count) {
+   lum.lum_stripe_count = stripe_count;
+   if (copy_to_user(ulmv, &lum, sizeof(lum))) {
+   rc = -EFAULT;
+   goto finish_req;
+   }
+   rc = -E2BIG;
+   goto finish_req;
+   }
+
lum_size = lmv_user_md_size(stripe_count, LMV_MAGIC_V1);
tmp = kzalloc(lum_size, GFP_NOFS);
if (!tmp) {
-- 
1.7.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 23/29] staging: lustre: ptlrpc: do not sleep if encpool reached max capacity

2016-10-27 Thread James Simmons
From: Sebastien Buisson 

When encryption is enabled RPCs are encrypted just before being
sent. The encryption requires allocating memory in the encoding pool.
The current implementation in sptlrpc_enc_pool_get_pages() is
deadlock-prone. Indeed, if there is no more free pages in the pool,
all ptlrpcd threads can end up waiting in a queue, so there is no
thread available to process other requests. It means client is not
able to process replies from servers that yet contain last committed
transno useful to release memory allocated by previous requests,
including enc_pool pages.

To fix this, in sptlrpc_enc_pool_get_pages(), do not make ptlrpcd
threads wait in queue if encoding pool has already reached its maximum
capacity. Instead, return -ENOMEM. If functions calling ptl_send_rpc()
get -ENOMEM, then put back request in queue by moving it back to
RQ_PHASE_NEW phase.

As an optimization, do not call ptl_send_rpc() again for requests that
already failed to allocate in the enc_pool, as long as there is not
enough memory in the enc_pool to satisfy theirs needs.

In /sys/fs/lustre/sptlrpc/encrypt_page_pools, add a new 'out of mem'
stat to track how many requests fail to allocate memory in the
enc_pool.

Signed-off-by: Sebastien Buisson 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6356
Reviewed-on: http://review.whamcloud.com/15070
Reviewed-by: Andreas Dilger 
Reviewed-by: Dmitry Eremin 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/include/lustre_sec.h |2 +
 drivers/staging/lustre/lustre/ptlrpc/client.c  |   25 +
 drivers/staging/lustre/lustre/ptlrpc/niobuf.c  |9 +-
 drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c|   29 +---
 4 files changed, 60 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_sec.h 
b/drivers/staging/lustre/lustre/include/lustre_sec.h
index 90c1834..89658e0 100644
--- a/drivers/staging/lustre/lustre/include/lustre_sec.h
+++ b/drivers/staging/lustre/lustre/include/lustre_sec.h
@@ -1029,6 +1029,8 @@ int  sptlrpc_target_export_check(struct obd_export *exp,
 
 /* bulk security api */
 void sptlrpc_enc_pool_put_pages(struct ptlrpc_bulk_desc *desc);
+int get_free_pages_in_pool(void);
+int pool_is_at_full_capacity(void);
 
 int sptlrpc_cli_wrap_bulk(struct ptlrpc_request *req,
  struct ptlrpc_bulk_desc *desc);
diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c 
b/drivers/staging/lustre/lustre/ptlrpc/client.c
index bda925e..cc4b129 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/client.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/client.c
@@ -1440,6 +1440,13 @@ static int ptlrpc_send_new_req(struct ptlrpc_request 
*req)
int rc;
 
LASSERT(req->rq_phase == RQ_PHASE_NEW);
+
+   /* do not try to go further if there is not enough memory in enc_pool */
+   if (req->rq_sent && req->rq_bulk)
+   if (req->rq_bulk->bd_iov_count > get_free_pages_in_pool() &&
+   pool_is_at_full_capacity())
+   return -ENOMEM;
+
if (req->rq_sent && (req->rq_sent > ktime_get_real_seconds()) &&
(!req->rq_generation_set ||
 req->rq_import_generation == imp->imp_generation))
@@ -1533,6 +1540,16 @@ static int ptlrpc_send_new_req(struct ptlrpc_request 
*req)
   lustre_msg_get_opc(req->rq_reqmsg));
 
rc = ptl_send_rpc(req, 0);
+   if (rc == -ENOMEM) {
+   spin_lock(&imp->imp_lock);
+   if (!list_empty(&req->rq_list)) {
+   list_del_init(&req->rq_list);
+   atomic_dec(&req->rq_import->imp_inflight);
+   }
+   spin_unlock(&imp->imp_lock);
+   ptlrpc_rqphase_move(req, RQ_PHASE_NEW);
+   return rc;
+   }
if (rc) {
DEBUG_REQ(D_HA, req, "send failed (%d); expect timeout", rc);
spin_lock(&req->rq_lock);
@@ -1822,6 +1839,14 @@ int ptlrpc_check_set(const struct lu_env *env, struct 
ptlrpc_request_set *set)
}
 
rc = ptl_send_rpc(req, 0);
+   if (rc == -ENOMEM) {
+   spin_lock(&imp->imp_lock);
+   if (!list_empty(&req->rq_list))
+   list_del_init(&req->rq_list);
+   spin_unlock(&imp->imp_lock);
+   ptlrpc_rqphase_move(req, RQ_PHASE_NEW);
+   continue;
+   }
if (rc) {
DEBUG_REQ(D_HA, req,
  "send failed: rc = %d", rc);
diff --git a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c 
b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c
index c2dd94

[PATCH 21/29] staging: lustre: obdclass: race lustre_profile_list

2016-10-27 Thread James Simmons
From: Hiroya Nozaki 

Running multiple mounts at the same time results in
lustre_profile_list corruption when adding a new profile.

This patch adds a new spin_lock to protect the list and
avoid the bug

Signed-off-by: Hiroya Nozaki 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6600
Reviewed-on: http://review.whamcloud.com/14896
Reviewed-by: Andreas Dilger 
Reviewed-by: Jian Yu 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/include/obd_class.h  |3 +
 drivers/staging/lustre/lustre/llite/llite_lib.c|2 +
 .../staging/lustre/lustre/obdclass/obd_config.c|   57 +---
 3 files changed, 54 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/obd_class.h 
b/drivers/staging/lustre/lustre/include/obd_class.h
index 476b1e4..f79133c 100644
--- a/drivers/staging/lustre/lustre/include/obd_class.h
+++ b/drivers/staging/lustre/lustre/include/obd_class.h
@@ -182,10 +182,13 @@ struct lustre_profile {
char*lp_profile;
char*lp_dt;
char*lp_md;
+   int lp_refs;
+   boollp_list_deleted;
 };
 
 struct lustre_profile *class_get_profile(const char *prof);
 void class_del_profile(const char *prof);
+void class_put_profile(struct lustre_profile *lprof);
 void class_del_profiles(void);
 
 #if LUSTRE_TRACKS_LOCK_EXP_REFS
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c 
b/drivers/staging/lustre/lustre/llite/llite_lib.c
index b896ac1..308da06 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -929,6 +929,8 @@ int ll_fill_super(struct super_block *sb, struct vfsmount 
*mnt)
 out_free:
kfree(md);
kfree(dt);
+   if (lprof)
+   class_put_profile(lprof);
if (err)
ll_put_super(sb);
else if (sbi->ll_flags & LL_SBI_VERBOSE)
diff --git a/drivers/staging/lustre/lustre/obdclass/obd_config.c 
b/drivers/staging/lustre/lustre/obdclass/obd_config.c
index bbed1b7..017bdac 100644
--- a/drivers/staging/lustre/lustre/obdclass/obd_config.c
+++ b/drivers/staging/lustre/lustre/obdclass/obd_config.c
@@ -585,16 +585,21 @@ static int class_del_conn(struct obd_device *obd, struct 
lustre_cfg *lcfg)
 }
 
 static LIST_HEAD(lustre_profile_list);
+static DEFINE_SPINLOCK(lustre_profile_list_lock);
 
 struct lustre_profile *class_get_profile(const char *prof)
 {
struct lustre_profile *lprof;
 
+   spin_lock(&lustre_profile_list_lock);
list_for_each_entry(lprof, &lustre_profile_list, lp_list) {
if (!strcmp(lprof->lp_profile, prof)) {
+   lprof->lp_refs++;
+   spin_unlock(&lustre_profile_list_lock);
return lprof;
}
}
+   spin_unlock(&lustre_profile_list_lock);
return NULL;
 }
 EXPORT_SYMBOL(class_get_profile);
@@ -639,7 +644,11 @@ static int class_add_profile(int proflen, char *prof, int 
osclen, char *osc,
}
}
 
+   spin_lock(&lustre_profile_list_lock);
+   lprof->lp_refs = 1;
+   lprof->lp_list_deleted = false;
list_add(&lprof->lp_list, &lustre_profile_list);
+   spin_unlock(&lustre_profile_list_lock);
return err;
 
 free_lp_dt:
@@ -659,27 +668,59 @@ void class_del_profile(const char *prof)
 
lprof = class_get_profile(prof);
if (lprof) {
+   spin_lock(&lustre_profile_list_lock);
+   /* because get profile increments the ref counter */
+   lprof->lp_refs--;
list_del(&lprof->lp_list);
-   kfree(lprof->lp_profile);
-   kfree(lprof->lp_dt);
-   kfree(lprof->lp_md);
-   kfree(lprof);
+   lprof->lp_list_deleted = true;
+   spin_unlock(&lustre_profile_list_lock);
+
+   class_put_profile(lprof);
}
 }
 EXPORT_SYMBOL(class_del_profile);
 
+void class_put_profile(struct lustre_profile *lprof)
+{
+   spin_lock(&lustre_profile_list_lock);
+   if (--lprof->lp_refs > 0) {
+   LASSERT(lprof->lp_refs > 0);
+   spin_unlock(&lustre_profile_list_lock);
+   return;
+   }
+   spin_unlock(&lustre_profile_list_lock);
+
+   /* confirm not a negative number */
+   LASSERT(!lprof->lp_refs);
+
+   /*
+* At least one class_del_profile/profiles must be called
+* on the target profile or lustre_profile_list will corrupt
+*/
+   LASSERT(lprof->lp_list_deleted);
+   kfree(lprof->lp_profile);
+   kfree(lprof->lp_dt);
+   kfree(lprof->lp_md);
+   kfree(lprof);
+}
+EXPORT_SYMBOL(class_put_profile);
+
 /* COMPAT_146 */
 void class_del_profiles(void)
 {
struct lustre_profile *lprof, *n;
 
+   spin_lock(&lustre_profile_list_lock);
list_for_each_entry_safe(lprof, n, &lustre_profile_list, lp_li

[PATCH 04/29] staging: lustre: obdclass: variable llog chunk size

2016-10-27 Thread James Simmons
From: Andreas Dilger 

Do not use fix LLOG_CHUNK_SIZE (8192 bytes), and
it will get the llog_chunk_size from llog_log_hdr.
Accordingly llog header will be variable too, so
we can enlarge the bitmap in the header, then
have more records in each llog file.

Signed-off-by: Andreas Dilger 
Signed-off-by: wang di 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6602
Reviewed-on: http://review.whamcloud.com/14883
Reviewed-by: Fan Yong 
Reviewed-by: James Simmons 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 .../lustre/lustre/include/lustre/lustre_idl.h  |   39 
 drivers/staging/lustre/lustre/include/lustre_log.h |6 +++
 drivers/staging/lustre/lustre/obdclass/llog.c  |   48 +++
 drivers/staging/lustre/lustre/obdclass/llog_obd.c  |1 +
 drivers/staging/lustre/lustre/obdclass/llog_swab.c |8 ++-
 drivers/staging/lustre/lustre/ptlrpc/llog_client.c |   20 ++--
 6 files changed, 84 insertions(+), 38 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h 
b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
index 5d2f845..e542ce6 100644
--- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
@@ -3122,13 +3122,6 @@ struct llog_gen_rec {
struct llog_rec_taillgr_tail;
 };
 
-/* On-disk header structure of each log object, stored in little endian order 
*/
-#define LLOG_CHUNK_SIZE 8192
-#define LLOG_HEADER_SIZE   (96)
-#define LLOG_BITMAP_BYTES   (LLOG_CHUNK_SIZE - LLOG_HEADER_SIZE)
-
-#define LLOG_MIN_REC_SIZE   (24) /* round(llog_rec_hdr + llog_rec_tail) */
-
 /* flags for the logs */
 enum llog_flag {
LLOG_F_ZAP_WHEN_EMPTY   = 0x1,
@@ -3139,6 +3132,15 @@ enum llog_flag {
LLOG_F_EXT_MASK = LLOG_F_EXT_JOBID,
 };
 
+/* On-disk header structure of each log object, stored in little endian order 
*/
+#define LLOG_MIN_CHUNK_SIZE8192
+#define LLOG_HEADER_SIZE   (96)/* sizeof (llog_log_hdr) +
+* sizeof(llh_tail) - sizeof(llh_bitmap)
+*/
+#define LLOG_BITMAP_BYTES  (LLOG_MIN_CHUNK_SIZE - LLOG_HEADER_SIZE)
+#define LLOG_MIN_REC_SIZE  (24)/* round(llog_rec_hdr + llog_rec_tail) 
*/
+
+/* flags for the logs */
 struct llog_log_hdr {
struct llog_rec_hdr llh_hdr;
__s64  llh_timestamp;
@@ -3150,13 +3152,30 @@ struct llog_log_hdr {
/* for a catalog the first plain slot is next to it */
struct obd_uuid  llh_tgtuuid;
__u32  llh_reserved[LLOG_HEADER_SIZE / sizeof(__u32) - 23];
+   /* These fields must always be at the end of the llog_log_hdr.
+* Note: llh_bitmap size is variable because llog chunk size could be
+* bigger than LLOG_MIN_CHUNK_SIZE, i.e. sizeof(llog_log_hdr) > 8192
+* bytes, and the real size is stored in llh_hdr.lrh_len, which means
+* llh_tail should only be referred by LLOG_HDR_TAIL().
+* But this structure is also used by client/server llog interface
+* (see llog_client.c), it will be kept in its original way to avoid
+* compatibility issue.
+*/
__u32  llh_bitmap[LLOG_BITMAP_BYTES / sizeof(__u32)];
struct llog_rec_tailllh_tail;
 } __packed;
 
-#define LLOG_BITMAP_SIZE(llh)  (__u32)((llh->llh_hdr.lrh_len - \
-   llh->llh_bitmap_offset -\
-   sizeof(llh->llh_tail)) * 8)
+#undef LLOG_HEADER_SIZE
+#undef LLOG_BITMAP_BYTES
+
+#define LLOG_HDR_BITMAP_SIZE(llh) (__u32)((llh->llh_hdr.lrh_len -  \
+  llh->llh_bitmap_offset - \
+  sizeof(llh->llh_tail)) * 8)
+#define LLOG_HDR_BITMAP(llh)   (__u32 *)((char *)(llh) +   \
+ (llh)->llh_bitmap_offset)
+#define LLOG_HDR_TAIL(llh) ((struct llog_rec_tail *)((char *)llh + \
+llh->llh_hdr.lrh_len - 
\
+sizeof(llh->llh_tail)))
 
 /** log cookies are used to reference a specific log file and a record
  * therein
diff --git a/drivers/staging/lustre/lustre/include/lustre_log.h 
b/drivers/staging/lustre/lustre/include/lustre_log.h
index 995b266..35e37eb 100644
--- a/drivers/staging/lustre/lustre/include/lustre_log.h
+++ b/drivers/staging/lustre/lustre/include/lustre_log.h
@@ -214,6 +214,7 @@ struct llog_handle {
spinlock_t   lgh_hdr_lock; /* protect lgh_hdr data */
struct llog_logidlgh_id; /* id of this log */
struct llog_log_hdr *lgh_hdr;
+   size_t   lgh_hdr_size;
int  lgh_last_idx;
int  lgh_cur_idx; /* used during llog_process */
__u6

[PATCH 08/29] staging: lustre: clio: update file attributes after sync

2016-10-27 Thread James Simmons
From: Bobi Jam 

This really only affects clients that are attached to lustre
server running ZFS, because zfs does not update # of blocks
until the blocks are flushed to disk.

This patch update file's blocks attribute after OST_SYNC completes.

Signed-off-by: Bobi Jam 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4389
Reviewed-on: http://review.whamcloud.com/12915
Reviewed-by: Nathaniel Clark 
Reviewed-by: Andreas Dilger 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/osc/osc_internal.h |2 +-
 drivers/staging/lustre/lustre/osc/osc_io.c   |3 +--
 drivers/staging/lustre/lustre/osc/osc_request.c  |   21 -
 3 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lustre/osc/osc_internal.h 
b/drivers/staging/lustre/lustre/osc/osc_internal.h
index dc708ea..12d3b58 100644
--- a/drivers/staging/lustre/lustre/osc/osc_internal.h
+++ b/drivers/staging/lustre/lustre/osc/osc_internal.h
@@ -124,7 +124,7 @@ int osc_setattr_async(struct obd_export *exp, struct obdo 
*oa,
 int osc_punch_base(struct obd_export *exp, struct obdo *oa,
   obd_enqueue_update_f upcall, void *cookie,
   struct ptlrpc_request_set *rqset);
-int osc_sync_base(struct obd_export *exp, struct obdo *oa,
+int osc_sync_base(struct osc_object *exp, struct obdo *oa,
  obd_enqueue_update_f upcall, void *cookie,
  struct ptlrpc_request_set *rqset);
 
diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c 
b/drivers/staging/lustre/lustre/osc/osc_io.c
index 8eb4275..3b82d0a 100644
--- a/drivers/staging/lustre/lustre/osc/osc_io.c
+++ b/drivers/staging/lustre/lustre/osc/osc_io.c
@@ -760,8 +760,7 @@ static int osc_fsync_ost(const struct lu_env *env, struct 
osc_object *obj,
 
init_completion(&cbargs->opc_sync);
 
-   rc = osc_sync_base(osc_export(obj), oa, osc_async_upcall, cbargs,
-  PTLRPCD_SET);
+   rc = osc_sync_base(obj, oa, osc_async_upcall, cbargs, PTLRPCD_SET);
return rc;
 }
 
diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c 
b/drivers/staging/lustre/lustre/osc/osc_request.c
index c570d19..091558e 100644
--- a/drivers/staging/lustre/lustre/osc/osc_request.c
+++ b/drivers/staging/lustre/lustre/osc/osc_request.c
@@ -82,6 +82,7 @@ struct osc_setattr_args {
 };
 
 struct osc_fsync_args {
+   struct osc_object   *fa_obj;
struct obdo *fa_oa;
obd_enqueue_update_f fa_upcall;
void*fa_cookie;
@@ -365,8 +366,11 @@ static int osc_sync_interpret(const struct lu_env *env,
  struct ptlrpc_request *req,
  void *arg, int rc)
 {
+   struct cl_attr *attr = &osc_env_info(env)->oti_attr;
struct osc_fsync_args *fa = arg;
+   unsigned long valid = 0;
struct ost_body *body;
+   struct cl_object *obj;
 
if (rc)
goto out;
@@ -379,15 +383,29 @@ static int osc_sync_interpret(const struct lu_env *env,
}
 
*fa->fa_oa = body->oa;
+   obj = osc2cl(fa->fa_obj);
+
+   /* Update osc object's blocks attribute */
+   cl_object_attr_lock(obj);
+   if (body->oa.o_valid & OBD_MD_FLBLOCKS) {
+   attr->cat_blocks = body->oa.o_blocks;
+   valid |= CAT_BLOCKS;
+   }
+
+   if (valid)
+   cl_object_attr_update(env, obj, attr, valid);
+   cl_object_attr_unlock(obj);
+
 out:
rc = fa->fa_upcall(fa->fa_cookie, rc);
return rc;
 }
 
-int osc_sync_base(struct obd_export *exp, struct obdo *oa,
+int osc_sync_base(struct osc_object *obj, struct obdo *oa,
  obd_enqueue_update_f upcall, void *cookie,
  struct ptlrpc_request_set *rqset)
 {
+   struct obd_export *exp = osc_export(obj);
struct ptlrpc_request *req;
struct ost_body *body;
struct osc_fsync_args *fa;
@@ -414,6 +432,7 @@ int osc_sync_base(struct obd_export *exp, struct obdo *oa,
 
CLASSERT(sizeof(*fa) <= sizeof(req->rq_async_args));
fa = ptlrpc_req_async_args(req);
+   fa->fa_obj = obj;
fa->fa_oa = oa;
fa->fa_upcall = upcall;
fa->fa_cookie = cookie;
-- 
1.7.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 18/29] staging: lustre: mdt: disable IMA support

2016-10-27 Thread James Simmons
From: Hongchao Zhang 

For IMA (Integrity Measurement Architecture), there are two xattr
"security.ima" and "security.evm" to protect the file to be modified
accidentally or maliciously, the two xattr are not compatible with
VBR, then disable it to workaround the problem currently and enable
it when the conditions are ready.

Signed-off-by: Hongchao Zhang 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6455
Reviewed-on: http://review.whamcloud.com/14928
Reviewed-by: Andreas Dilger 
Reviewed-by: Mike Pershin 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/llite/xattr.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/xattr.c 
b/drivers/staging/lustre/lustre/llite/xattr.c
index 3ae1a02..ea3becc 100644
--- a/drivers/staging/lustre/lustre/llite/xattr.c
+++ b/drivers/staging/lustre/lustre/llite/xattr.c
@@ -126,6 +126,11 @@ static int xattr_type_filter(struct ll_sb_info *sbi,
strcmp(name, "selinux") == 0)
return -EOPNOTSUPP;
 
+   /*FIXME: enable IMA when the conditions are ready */
+   if (handler->flags == XATTR_SECURITY_T &&
+   (!strcmp(name, "ima") || !strcmp(name, "evm")))
+   return -EOPNOTSUPP;
+
sprintf(fullname, "%s%s\n", handler->prefix, name);
rc = md_setxattr(sbi->ll_md_exp, ll_inode2fid(inode),
 valid, fullname, pv, size, 0, flags,
-- 
1.7.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 16/29] staging: lustre: mdc: deactive MDT permanently

2016-10-27 Thread James Simmons
From: wang di 

Add active proc entry for MDC, and mark MDC to
be inactive once the MDC is deactivated.

Signed-off-by: wang di 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6586
Reviewed-on: http://review.whamcloud.com/14747
Reviewed-by: Lai Siyao 
Reviewed-by: James Simmons 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/lmv/lmv_obd.c   |1 +
 drivers/staging/lustre/lustre/mdc/lproc_mdc.c |   37 +
 2 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c 
b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
index 7a8d1c8..12e8b1e 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
@@ -62,6 +62,7 @@ static void lmv_activate_target(struct lmv_obd *lmv,
 
tgt->ltd_active = activate;
lmv->desc.ld_active_tgt_count += (activate ? 1 : -1);
+   tgt->ltd_exp->exp_obd->obd_inactive = !activate;
 }
 
 /**
diff --git a/drivers/staging/lustre/lustre/mdc/lproc_mdc.c 
b/drivers/staging/lustre/lustre/mdc/lproc_mdc.c
index c89003a..9021c46 100644
--- a/drivers/staging/lustre/lustre/mdc/lproc_mdc.c
+++ b/drivers/staging/lustre/lustre/mdc/lproc_mdc.c
@@ -36,6 +36,42 @@
 #include "../include/lprocfs_status.h"
 #include "mdc_internal.h"
 
+static ssize_t active_show(struct kobject *kobj, struct attribute *attr,
+  char *buf)
+{
+   struct obd_device *dev = container_of(kobj, struct obd_device,
+ obd_kobj);
+
+   return sprintf(buf, "%u\n", !dev->u.cli.cl_import->imp_deactive);
+}
+
+static ssize_t active_store(struct kobject *kobj, struct attribute *attr,
+   const char *buffer, size_t count)
+{
+   struct obd_device *dev = container_of(kobj, struct obd_device,
+ obd_kobj);
+   unsigned long val;
+   int rc;
+
+   rc = kstrtoul(buffer, 10, &val);
+   if (rc)
+   return rc;
+
+   if (val < 0 || val > 1)
+   return -ERANGE;
+
+   /* opposite senses */
+   if (dev->u.cli.cl_import->imp_deactive == val) {
+   rc = ptlrpc_set_import_active(dev->u.cli.cl_import, val);
+   if (rc)
+   count = rc;
+   } else {
+   CDEBUG(D_CONFIG, "activate %lu: ignoring repeat request\n", 
val);
+   }
+   return count;
+}
+LUSTRE_RW_ATTR(active);
+
 static ssize_t max_rpcs_in_flight_show(struct kobject *kobj,
   struct attribute *attr,
   char *buf)
@@ -176,6 +212,7 @@ static ssize_t max_pages_per_rpc_show(struct kobject *kobj,
 };
 
 static struct attribute *mdc_attrs[] = {
+   &lustre_attr_active.attr,
&lustre_attr_max_rpcs_in_flight.attr,
&lustre_attr_max_mod_rpcs_in_flight.attr,
&lustre_attr_max_pages_per_rpc.attr,
-- 
1.7.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 29/29] staging: lustre: llog: record the minimum record size

2016-10-27 Thread James Simmons
From: wang di 

The minimum record size will be recorded in llh_size, which is
only used by fixed size record llog now, and also add another
flag LLOG_F_IS_FIXSIZE to indicate the fix size record llog.

Signed-off-by: wang di 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7050
Reviewed-on: http://review.whamcloud.com/16103
Reviewed-by: Mike Pershin 
Reviewed-by: James Simmons 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 .../lustre/lustre/include/lustre/lustre_idl.h  |7 +++
 drivers/staging/lustre/lustre/obdclass/llog.c  |1 +
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h 
b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
index 6896c37..db09f3b 100644
--- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
@@ -3020,7 +3020,14 @@ enum llog_flag {
LLOG_F_IS_CAT   = 0x2,
LLOG_F_IS_PLAIN = 0x4,
LLOG_F_EXT_JOBID= BIT(3),
+   LLOG_F_IS_FIXSIZE   = BIT(4),
 
+   /*
+* Note: Flags covered by LLOG_F_EXT_MASK will be inherited from
+* catlog to plain log, so do not add LLOG_F_IS_FIXSIZE here,
+* because the catlog record is usually fixed size, but its plain
+* log record can be variable
+*/
LLOG_F_EXT_MASK = LLOG_F_EXT_JOBID,
 };
 
diff --git a/drivers/staging/lustre/lustre/obdclass/llog.c 
b/drivers/staging/lustre/lustre/obdclass/llog.c
index 5c9447e..3bc1789 100644
--- a/drivers/staging/lustre/lustre/obdclass/llog.c
+++ b/drivers/staging/lustre/lustre/obdclass/llog.c
@@ -193,6 +193,7 @@ int llog_init_handle(const struct lu_env *env, struct 
llog_handle *handle,
LASSERT(list_empty(&handle->u.chd.chd_head));
INIT_LIST_HEAD(&handle->u.chd.chd_head);
llh->llh_size = sizeof(struct llog_logid_rec);
+   llh->llh_flags |= LLOG_F_IS_FIXSIZE;
} else if (!(flags & LLOG_F_IS_PLAIN)) {
CERROR("%s: unknown flags: %#x (expected %#x or %#x)\n",
   handle->lgh_ctxt->loc_obd->obd_name,
-- 
1.7.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 24/29] staging: lustre: ptlrpc: Forbid too early NRS policy tunings

2016-10-27 Thread James Simmons
From: Henri Doreau 

Wait for a NRS policy to be fully started before allowing
to apply related tunings, so that all fields are properly
initialized.

Signed-off-by: Henri Doreau 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6673
Reviewed-on: http://review.whamcloud.com/15104
Reviewed-by: Emoly Liu 
Reviewed-by: Andreas Dilger 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/ptlrpc/nrs.c |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/nrs.c 
b/drivers/staging/lustre/lustre/ptlrpc/nrs.c
index d88faf6..f856632 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/nrs.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/nrs.c
@@ -619,6 +619,15 @@ static int nrs_policy_ctl(struct ptlrpc_nrs *nrs, char 
*name,
goto out;
}
 
+   /**
+* Wait for the policy to be fully started before attempting
+* to operate it.
+*/
+   if (policy->pol_state == NRS_POL_STATE_STARTING) {
+   rc = -EAGAIN;
+   goto out;
+   }
+
switch (opc) {
/**
 * Unknown opcode, pass it down to the policy-specific control
-- 
1.7.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 27/29] staging: lustre: headers: Create single .h for lu_seq_range

2016-10-27 Thread James Simmons
From: Ben Evans 

Put lu_seq_range related functions into a single .h.
Include directly from files which use it, and remove
definitions from lustre_idl.h.

Signed-off-by: Ben Evans 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6401
Reviewed-on: http://review.whamcloud.com/15952
Reviewed-by: Andreas Dilger 
Reviewed-by: James Simmons 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/fid/fid_request.c|   14 +-
 drivers/staging/lustre/lustre/fid/lproc_fid.c  |2 +-
 drivers/staging/lustre/lustre/fld/fld_cache.c  |6 +-
 .../lustre/lustre/include/lustre/lustre_idl.h  |  108 ---
 drivers/staging/lustre/lustre/include/lustre_fid.h |1 +
 drivers/staging/lustre/lustre/include/seq_range.h  |  199 
 6 files changed, 211 insertions(+), 119 deletions(-)
 create mode 100644 drivers/staging/lustre/lustre/include/seq_range.h

diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c 
b/drivers/staging/lustre/lustre/fid/fid_request.c
index dfef3ca..999f250 100644
--- a/drivers/staging/lustre/lustre/fid/fid_request.c
+++ b/drivers/staging/lustre/lustre/fid/fid_request.c
@@ -74,7 +74,7 @@ static int seq_client_rpc(struct lu_client_seq *seq,
 
/* Zero out input range, this is not recovery yet. */
in = req_capsule_client_get(&req->rq_pill, &RMF_SEQ_RANGE);
-   range_init(in);
+   lu_seq_range_init(in);
 
ptlrpc_request_set_replen(req);
 
@@ -119,14 +119,14 @@ static int seq_client_rpc(struct lu_client_seq *seq,
out = req_capsule_server_get(&req->rq_pill, &RMF_SEQ_RANGE);
*output = *out;
 
-   if (!range_is_sane(output)) {
+   if (!lu_seq_range_is_sane(output)) {
CERROR("%s: Invalid range received from server: "
   DRANGE "\n", seq->lcs_name, PRANGE(output));
rc = -EINVAL;
goto out_req;
}
 
-   if (range_is_exhausted(output)) {
+   if (lu_seq_range_is_exhausted(output)) {
CERROR("%s: Range received from server is exhausted: "
   DRANGE "]\n", seq->lcs_name, PRANGE(output));
rc = -EINVAL;
@@ -166,9 +166,9 @@ static int seq_client_alloc_seq(const struct lu_env *env,
 {
int rc;
 
-   LASSERT(range_is_sane(&seq->lcs_space));
+   LASSERT(lu_seq_range_is_sane(&seq->lcs_space));
 
-   if (range_is_exhausted(&seq->lcs_space)) {
+   if (lu_seq_range_is_exhausted(&seq->lcs_space)) {
rc = seq_client_alloc_meta(env, seq);
if (rc) {
CERROR("%s: Can't allocate new meta-sequence, rc %d\n",
@@ -181,7 +181,7 @@ static int seq_client_alloc_seq(const struct lu_env *env,
rc = 0;
}
 
-   LASSERT(!range_is_exhausted(&seq->lcs_space));
+   LASSERT(!lu_seq_range_is_exhausted(&seq->lcs_space));
*seqnr = seq->lcs_space.lsr_start;
seq->lcs_space.lsr_start += 1;
 
@@ -316,7 +316,7 @@ void seq_client_flush(struct lu_client_seq *seq)
 
seq->lcs_space.lsr_index = -1;
 
-   range_init(&seq->lcs_space);
+   lu_seq_range_init(&seq->lcs_space);
mutex_unlock(&seq->lcs_mutex);
 }
 EXPORT_SYMBOL(seq_client_flush);
diff --git a/drivers/staging/lustre/lustre/fid/lproc_fid.c 
b/drivers/staging/lustre/lustre/fid/lproc_fid.c
index 3ed32d7..97d4849 100644
--- a/drivers/staging/lustre/lustre/fid/lproc_fid.c
+++ b/drivers/staging/lustre/lustre/fid/lproc_fid.c
@@ -83,7 +83,7 @@
(unsigned long long *)&tmp.lsr_end);
if (rc != 2)
return -EINVAL;
-   if (!range_is_sane(&tmp) || range_is_zero(&tmp) ||
+   if (!lu_seq_range_is_sane(&tmp) || lu_seq_range_is_zero(&tmp) ||
tmp.lsr_start < range->lsr_start || tmp.lsr_end > range->lsr_end)
return -EINVAL;
*range = tmp;
diff --git a/drivers/staging/lustre/lustre/fld/fld_cache.c 
b/drivers/staging/lustre/lustre/fld/fld_cache.c
index 0100a93..11f6974 100644
--- a/drivers/staging/lustre/lustre/fld/fld_cache.c
+++ b/drivers/staging/lustre/lustre/fld/fld_cache.c
@@ -143,7 +143,7 @@ static void fld_fix_new_list(struct fld_cache *cache)
c_range = &f_curr->fce_range;
n_range = &f_next->fce_range;
 
-   LASSERT(range_is_sane(c_range));
+   LASSERT(lu_seq_range_is_sane(c_range));
if (&f_next->fce_list == head)
break;
 
@@ -358,7 +358,7 @@ struct fld_cache_entry
 {
struct fld_cache_entry *f_new;
 
-   LASSERT(range_is_sane(range));
+   LASSERT(lu_seq_range_is_sane(range));
 
f_new = kzalloc(sizeof(*f_new), GFP_NOFS);
if (!f_new)
@@ -503,7 +503,7 @@ int fld_cache_lookup(struct fld_cache *cache,
}
 
prev = flde;
-   if (range_within(&flde->fce_range, seq)) {
+   if (lu_seq_range_within(&flde->fce_range, seq)) {
*ran

[PATCH 26/29] staging: lustre: ptlrpc: do not switch out-of-date context

2016-10-27 Thread James Simmons
From: Sebastien Buisson 

When trying to replace a dead sec context with a new one, we must
ensure the new context is already up-to-date.
If it is not the case, just return from sptlrpc_req_replace_dead_ctx()
and come later when the new context has been updated.

Signed-off-by: Sebastien Buisson 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6536
Reviewed-on: http://review.whamcloud.com/15708
Reviewed-by: Mike Pershin 
Reviewed-by: John L. Hammond 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/ptlrpc/sec.c |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec.c 
b/drivers/staging/lustre/lustre/ptlrpc/sec.c
index 12f02ed..e860df7 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec.c
@@ -515,6 +515,13 @@ static int sptlrpc_req_replace_dead_ctx(struct 
ptlrpc_request *req)
 
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(msecs_to_jiffies(MSEC_PER_SEC));
+   } else if (unlikely(!test_bit(PTLRPC_CTX_UPTODATE_BIT, 
&newctx->cc_flags))) {
+   /*
+* new ctx not up to date yet
+*/
+   CDEBUG(D_SEC,
+  "ctx (%p, fl %lx) doesn't switch, not up to date yet\n",
+  newctx, newctx->cc_flags);
} else {
/*
 * it's possible newctx == oldctx if we're switching
-- 
1.7.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 07/29] staging: lustre: lov: remove LSM from struct lustre_md

2016-10-27 Thread James Simmons
From: John L. Hammond 

In struct lustre_md replace the struct lov_stripe_md *lsm member with
an opaque struct lu_buf layout which holds the layout metadata
returned by the server. Refactor the LOV object initialization and
layout change code to accommodate this. Simplify lov_unpackmd() and
supporting functions according to the reduced number of use cases.

Signed-off-by: John L. Hammond 
Signed-off-by: Jinshan Xiong 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5814
Reviewed-on: http://review.whamcloud.com/13722
Reviewed-by: James Simmons 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/include/cl_object.h |2 +-
 drivers/staging/lustre/lustre/include/obd.h   |2 +-
 drivers/staging/lustre/lustre/llite/file.c|   29 +
 drivers/staging/lustre/lustre/llite/lcommon_cl.c  |2 +-
 drivers/staging/lustre/lustre/llite/llite_lib.c   |   11 +--
 drivers/staging/lustre/lustre/llite/namei.c   |7 +-
 drivers/staging/lustre/lustre/lov/lov_ea.c|9 +-
 drivers/staging/lustre/lustre/lov/lov_internal.h  |   15 +--
 drivers/staging/lustre/lustre/lov/lov_obd.c   |1 -
 drivers/staging/lustre/lustre/lov/lov_object.c|  120 -
 drivers/staging/lustre/lustre/lov/lov_pack.c  |  100 +++---
 drivers/staging/lustre/lustre/mdc/mdc_request.c   |   19 +---
 12 files changed, 134 insertions(+), 183 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/cl_object.h 
b/drivers/staging/lustre/lustre/include/cl_object.h
index dfef4bc..514d650 100644
--- a/drivers/staging/lustre/lustre/include/cl_object.h
+++ b/drivers/staging/lustre/lustre/include/cl_object.h
@@ -267,7 +267,7 @@ struct cl_object_conf {
/**
 * Object layout. This is consumed by lov.
 */
-   struct lustre_md *coc_md;
+   struct lu_buf coc_layout;
/**
 * Description of particular stripe location in the
 * cluster. This is consumed by osc.
diff --git a/drivers/staging/lustre/lustre/include/obd.h 
b/drivers/staging/lustre/lustre/include/obd.h
index ebb3012..c8a6e23 100644
--- a/drivers/staging/lustre/lustre/include/obd.h
+++ b/drivers/staging/lustre/lustre/include/obd.h
@@ -864,7 +864,7 @@ struct obd_ops {
 /* lmv structures */
 struct lustre_md {
struct mdt_body  *body;
-   struct lov_stripe_md*lsm;
+   struct lu_buflayout;
struct lmv_stripe_md*lmv;
 #ifdef CONFIG_FS_POSIX_ACL
struct posix_acl*posix_acl;
diff --git a/drivers/staging/lustre/lustre/llite/file.c 
b/drivers/staging/lustre/lustre/llite/file.c
index 2c8df43..0ae78c7 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -3275,7 +3275,6 @@ static int ll_layout_lock_set(struct lustre_handle 
*lockh, enum ldlm_mode mode,
struct ll_inode_info *lli = ll_i2info(inode);
struct ll_sb_info*sbi = ll_i2sbi(inode);
struct ldlm_lock *lock;
-   struct lustre_md md = { NULL };
struct cl_object_conf conf;
int rc = 0;
bool lvb_ready;
@@ -3310,37 +3309,19 @@ static int ll_layout_lock_set(struct lustre_handle 
*lockh, enum ldlm_mode mode,
 
/* for layout lock, lmm is returned in lock's lvb.
 * lvb_data is immutable if the lock is held so it's safe to access it
-* without res lock. See the description in ldlm_lock_decref_internal()
-* for the condition to free lvb_data of layout lock
-*/
-   if (lock->l_lvb_data) {
-   rc = obd_unpackmd(sbi->ll_dt_exp, &md.lsm,
- lock->l_lvb_data, lock->l_lvb_len);
-   if (rc < 0) {
-   CERROR("%s: file " DFID " unpackmd error: %d\n",
-  ll_get_fsname(inode->i_sb, NULL, 0),
-  PFID(&lli->lli_fid), rc);
-   goto out;
-   }
-
-   LASSERTF(md.lsm, "lvb_data = %p, lvb_len = %u\n",
-lock->l_lvb_data, lock->l_lvb_len);
-   rc = 0;
-   }
-
-   /* set layout to file. Unlikely this will fail as old layout was
+* without res lock.
+*
+* set layout to file. Unlikely this will fail as old layout was
 * surely eliminated
 */
memset(&conf, 0, sizeof(conf));
conf.coc_opc = OBJECT_CONF_SET;
conf.coc_inode = inode;
conf.coc_lock = lock;
-   conf.u.coc_md = &md;
+   conf.u.coc_layout.lb_buf = lock->l_lvb_data;
+   conf.u.coc_layout.lb_len = lock->l_lvb_len;
rc = ll_layout_conf(inode, &conf);
 
-   if (md.lsm)
-   obd_free_memmd(sbi->ll_dt_exp, &md.lsm);
-
/* refresh layout failed, need to wait */
wait_layout = rc == -EBUSY;
 
diff --git a/drivers/staging/lustre/lustre/llite/lcommon_cl.c 
b/drivers/staging/

[PATCH 20/29] staging: lustre: recovery: don't skip open replay on reconnect

2016-10-27 Thread James Simmons
From: Niu Yawei 

Once reconnect happened during replay, we'd continue the open
replay with the last failed replay, but not the next.

Signed-off-by: Niu Yawei 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6802
Reviewed-on: http://review.whamcloud.com/15871
Reviewed-by: Jinshan Xiong 
Reviewed-by: Hongchao Zhang 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/ptlrpc/recover.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/recover.c 
b/drivers/staging/lustre/lustre/ptlrpc/recover.c
index aa96534..9144cd8 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/recover.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/recover.c
@@ -111,7 +111,9 @@ int ptlrpc_replay_next(struct obd_import *imp, int 
*inflight)
 * all of it's requests being replayed, it's safe to
 * use a cursor to accelerate the search
 */
-   imp->imp_replay_cursor = imp->imp_replay_cursor->next;
+   if (!imp->imp_resend_replay ||
+   imp->imp_replay_cursor == &imp->imp_committed_list)
+   imp->imp_replay_cursor = 
imp->imp_replay_cursor->next;
 
while (imp->imp_replay_cursor !=
   &imp->imp_committed_list) {
-- 
1.7.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 28/29] staging: lustre: ptlrpc: imp_peer_committed_transno should increase

2016-10-27 Thread James Simmons
From: Alex Zhuravlev 

imp_peer_committed_transno should not decrease as this can
confuse the users if imp_peer_committed_transno is used to
check commit status.

Signed-off-by: Alex Zhuravlev 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7079
Reviewed-on: http://review.whamcloud.com/16161
Reviewed-by: Mike Pershin 
Reviewed-by: wangdi 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/ptlrpc/client.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c 
b/drivers/staging/lustre/lustre/ptlrpc/client.c
index cc4b129..7cbfb4c 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/client.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/client.c
@@ -1242,6 +1242,7 @@ static int after_reply(struct ptlrpc_request *req)
int rc;
struct timespec64 work_start;
long timediff;
+   u64 committed;
 
LASSERT(obd);
/* repbuf must be unlinked */
@@ -1400,10 +1401,9 @@ static int after_reply(struct ptlrpc_request *req)
}
 
/* Replay-enabled imports return commit-status information. */
-   if (lustre_msg_get_last_committed(req->rq_repmsg)) {
-   imp->imp_peer_committed_transno =
-   lustre_msg_get_last_committed(req->rq_repmsg);
-   }
+   committed = lustre_msg_get_last_committed(req->rq_repmsg);
+   if (likely(committed > imp->imp_peer_committed_transno))
+   imp->imp_peer_committed_transno = committed;
 
ptlrpc_free_committed(imp);
 
-- 
1.7.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 10/29] staging: lustre: ptlrpc: embed highest XID in each request

2016-10-27 Thread James Simmons
From: Gregoire Pichon 

Atomically assign XIDs and put request and sending list so
we can learn the lowest unreplied XID at any point.

This allows to embed in every resquests the highest XID for
which a reply has been received and does not have an unreplied
lower-numbered XID.

This will be used by the MDT target to release in-memory
reply data corresponding to XIDs of reply received by the client.

Signed-off-by: Alex Zhuravlev 
Signed-off-by: Gregoire Pichon 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5319
Reviewed-on: http://review.whamcloud.com/14793
Reviewed-by: Andreas Dilger 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/include/lustre_net.h |1 +
 drivers/staging/lustre/lustre/ptlrpc/client.c  |   34 +++-
 .../staging/lustre/lustre/ptlrpc/pack_generic.c|   15 +
 3 files changed, 49 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h 
b/drivers/staging/lustre/lustre/include/lustre_net.h
index 67a7095..a14f1a4 100644
--- a/drivers/staging/lustre/lustre/include/lustre_net.h
+++ b/drivers/staging/lustre/lustre/include/lustre_net.h
@@ -2069,6 +2069,7 @@ void lustre_msg_set_handle(struct lustre_msg *msg,
   struct lustre_handle *handle);
 void lustre_msg_set_type(struct lustre_msg *msg, __u32 type);
 void lustre_msg_set_opc(struct lustre_msg *msg, __u32 opc);
+void lustre_msg_set_last_xid(struct lustre_msg *msg, u64 last_xid);
 void lustre_msg_set_tag(struct lustre_msg *msg, __u16 tag);
 void lustre_msg_set_versions(struct lustre_msg *msg, __u64 *versions);
 void lustre_msg_set_transno(struct lustre_msg *msg, __u64 transno);
diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c 
b/drivers/staging/lustre/lustre/ptlrpc/client.c
index e4a31eb..e4fbdd0 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/client.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/client.c
@@ -700,7 +700,6 @@ int ptlrpc_request_bufs_pack(struct ptlrpc_request *request,
 
ptlrpc_at_set_req_timeout(request);
 
-   request->rq_xid = ptlrpc_next_xid();
lustre_msg_set_opc(request->rq_reqmsg, opcode);
 
/* Let's setup deadline for req/reply/bulk unlink for opcode. */
@@ -1436,6 +1435,8 @@ static int after_reply(struct ptlrpc_request *req)
 static int ptlrpc_send_new_req(struct ptlrpc_request *req)
 {
struct obd_import *imp = req->rq_import;
+   struct list_head *tmp;
+   u64 min_xid = ~0ULL;
int rc;
 
LASSERT(req->rq_phase == RQ_PHASE_NEW);
@@ -1448,6 +1449,18 @@ static int ptlrpc_send_new_req(struct ptlrpc_request 
*req)
 
spin_lock(&imp->imp_lock);
 
+   /*
+* the very first time we assign XID. it's important to assign XID
+* and put it on the list atomically, so that the lowest assigned
+* XID is always known. this is vital for multislot last_rcvd
+*/
+   if (req->rq_send_state == LUSTRE_IMP_REPLAY) {
+   LASSERT(req->rq_xid);
+   } else {
+   LASSERT(!req->rq_xid);
+   req->rq_xid = ptlrpc_next_xid();
+   }
+
if (!req->rq_generation_set)
req->rq_import_generation = imp->imp_generation;
 
@@ -1477,8 +1490,27 @@ static int ptlrpc_send_new_req(struct ptlrpc_request 
*req)
LASSERT(list_empty(&req->rq_list));
list_add_tail(&req->rq_list, &imp->imp_sending_list);
atomic_inc(&req->rq_import->imp_inflight);
+
+   /* find the lowest unreplied XID */
+   list_for_each(tmp, &imp->imp_delayed_list) {
+   struct ptlrpc_request *r;
+
+   r = list_entry(tmp, struct ptlrpc_request, rq_list);
+   if (r->rq_xid < min_xid)
+   min_xid = r->rq_xid;
+   }
+   list_for_each(tmp, &imp->imp_sending_list) {
+   struct ptlrpc_request *r;
+
+   r = list_entry(tmp, struct ptlrpc_request, rq_list);
+   if (r->rq_xid < min_xid)
+   min_xid = r->rq_xid;
+   }
spin_unlock(&imp->imp_lock);
 
+   if (likely(min_xid != ~0ULL))
+   lustre_msg_set_last_xid(req->rq_reqmsg, min_xid - 1);
+
lustre_msg_set_status(req->rq_reqmsg, current_pid());
 
rc = sptlrpc_req_refresh_ctx(req, -1);
diff --git a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c 
b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c
index 1c06b4e..4f63a80 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c
@@ -1255,6 +1255,21 @@ void lustre_msg_set_opc(struct lustre_msg *msg, __u32 
opc)
}
 }
 
+void lustre_msg_set_last_xid(struct lustre_msg *msg, u64 last_xid)
+{
+   switch (msg->lm_magic) {
+   case LUSTRE_MSG_MAGIC_V2: {
+   struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
+
+   LASSERTF(pb, "invalid msg %p: no ptlrpc body!\n", msg);
+   pb->pb_last_xid = l

[PATCH 11/29] staging: lustre: llite: basic support of SELinux in CLIO

2016-10-27 Thread James Simmons
From: Sebastien Buisson 

Bring the ability to properly initiate security context
on SELinux-enabled client and store it on server side via
extended attribute.

Security context initialization is not atomic, but that would
require a wire protocol change to send security label in the
creation request.

Filter out security.selinux from xattr cache as it is
already cached in system slab.

Signed-off-by: Sebastien Buisson 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5560
Reviewed-on: http://review.whamcloud.com/11648
Reviewed-by: Dmitry Eremin 
Reviewed-by: Andreas Dilger 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/llite/Makefile   |6 +-
 drivers/staging/lustre/lustre/llite/dir.c  |   11 +++
 .../staging/lustre/lustre/llite/llite_internal.h   |4 +
 drivers/staging/lustre/lustre/llite/namei.c|5 +-
 drivers/staging/lustre/lustre/llite/xattr.c|   60 ++
 drivers/staging/lustre/lustre/llite/xattr_cache.c  |4 +
 .../staging/lustre/lustre/llite/xattr_security.c   |   88 
 7 files changed, 140 insertions(+), 38 deletions(-)
 create mode 100644 drivers/staging/lustre/lustre/llite/xattr_security.c

diff --git a/drivers/staging/lustre/lustre/llite/Makefile 
b/drivers/staging/lustre/lustre/llite/Makefile
index 3690bee..ca9c275 100644
--- a/drivers/staging/lustre/lustre/llite/Makefile
+++ b/drivers/staging/lustre/lustre/llite/Makefile
@@ -1,7 +1,7 @@
 obj-$(CONFIG_LUSTRE_FS) += lustre.o
 lustre-y := dcache.o dir.o file.o llite_lib.o llite_nfs.o \
-   rw.o namei.o symlink.o llite_mmap.o range_lock.o \
-   xattr.o xattr_cache.o rw26.o super25.o statahead.o \
-   glimpse.o lcommon_cl.o lcommon_misc.o \
+   rw.o rw26.o namei.o symlink.o llite_mmap.o range_lock.o \
+   xattr.o xattr_cache.o xattr_security.o \
+   super25.o statahead.o glimpse.o lcommon_cl.o lcommon_misc.o \
vvp_dev.o vvp_page.o vvp_lock.o vvp_io.o vvp_object.o vvp_req.o \
lproc_llite.o
diff --git a/drivers/staging/lustre/lustre/llite/dir.c 
b/drivers/staging/lustre/lustre/llite/dir.c
index 6e744a5..fb367ae 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -410,6 +410,8 @@ static int ll_dir_setdirstripe(struct inode *parent, struct 
lmv_user_md *lump,
struct ptlrpc_request *request = NULL;
struct md_op_data *op_data;
struct ll_sb_info *sbi = ll_i2sbi(parent);
+   struct inode *inode = NULL;
+   struct dentry dentry;
int err;
 
if (unlikely(lump->lum_magic != LMV_USER_MAGIC))
@@ -443,8 +445,17 @@ static int ll_dir_setdirstripe(struct inode *parent, 
struct lmv_user_md *lump,
from_kgid(&init_user_ns, current_fsgid()),
cfs_curproc_cap_pack(), 0, &request);
ll_finish_md_op_data(op_data);
+
+   err = ll_prep_inode(&inode, request, parent->i_sb, NULL);
if (err)
goto err_exit;
+
+   memset(&dentry, 0, sizeof(dentry));
+   dentry.d_inode = inode;
+
+   err = ll_init_security(&dentry, inode, parent);
+   iput(inode);
+
 err_exit:
ptlrpc_req_finished(request);
return err;
diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h 
b/drivers/staging/lustre/lustre/llite/llite_internal.h
index 80fb862..8bd1eb8 100644
--- a/drivers/staging/lustre/lustre/llite/llite_internal.h
+++ b/drivers/staging/lustre/lustre/llite/llite_internal.h
@@ -261,6 +261,9 @@ static inline void ll_layout_version_set(struct 
ll_inode_info *lli, __u32 gen)
 int ll_xattr_cache_get(struct inode *inode, const char *name,
   char *buffer, size_t size, __u64 valid);
 
+int ll_init_security(struct dentry *dentry, struct inode *inode,
+struct inode *dir);
+
 /*
  * Locking to guarantee consistency of non-atomic updates to long long i_size,
  * consistency between file size and KMS.
@@ -998,6 +1001,7 @@ static inline loff_t ll_file_maxbytes(struct inode *inode)
 ssize_t ll_listxattr(struct dentry *dentry, char *buffer, size_t size);
 int ll_xattr_list(struct inode *inode, const char *name, int type,
  void *buffer, size_t size, __u64 valid);
+const struct xattr_handler *get_xattr_type(const char *name);
 
 /**
  * Common IO arguments for various VFS I/O interfaces.
diff --git a/drivers/staging/lustre/lustre/llite/namei.c 
b/drivers/staging/lustre/lustre/llite/namei.c
index 89fd441..74d9b73 100644
--- a/drivers/staging/lustre/lustre/llite/namei.c
+++ b/drivers/staging/lustre/lustre/llite/namei.c
@@ -790,7 +790,8 @@ static int ll_create_it(struct inode *dir, struct dentry 
*dentry,
return PTR_ERR(inode);
 
d_instantiate(dentry, inode);
-   return 0;
+
+   return ll_init_security(dentry, inode, dir);
 }
 
 void ll_update_times(struct ptlrpc_request *request, struct inode *inode)
@@ -885,6 +886,8 @@ sta

[PATCH 15/29] staging: lustre: obdecho: don't copy lu_site

2016-10-27 Thread James Simmons
From: Niu Yawei 

While creating an echo device, echo_device_alloc() copies the lu_site
from MD stack, such kind of copy result in uninitialized mutex and
other potential issues.

Instead of copying the lu_site, we'd use the lu_site by pointer directly.

Signed-off-by: Niu Yawei 
Signed-off-by: Olaf Faaland 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6765
Reviewed-on: http://review.whamcloud.com/15657
Reviewed-by: Bobi Jam 
Reviewed-by: Lai Siyao 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 .../staging/lustre/lustre/obdecho/echo_client.c|   20 +++-
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c 
b/drivers/staging/lustre/lustre/obdecho/echo_client.c
index c69588c..30caf5f 100644
--- a/drivers/staging/lustre/lustre/obdecho/echo_client.c
+++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c
@@ -55,7 +55,7 @@ struct echo_device {
struct echo_client_obd *ed_ec;
 
struct cl_siteed_site_myself;
-   struct cl_site   *ed_site;
+   struct lu_site  *ed_site;
struct lu_device   *ed_next;
 };
 
@@ -527,17 +527,19 @@ static int echo_site_init(const struct lu_env *env, 
struct echo_device *ed)
}
 
rc = lu_site_init_finish(&site->cs_lu);
-   if (rc)
+   if (rc) {
+   cl_site_fini(site);
return rc;
+   }
 
-   ed->ed_site = site;
+   ed->ed_site = &site->cs_lu;
return 0;
 }
 
 static void echo_site_fini(const struct lu_env *env, struct echo_device *ed)
 {
if (ed->ed_site) {
-   cl_site_fini(ed->ed_site);
+   lu_site_fini(ed->ed_site);
ed->ed_site = NULL;
}
 }
@@ -674,7 +676,7 @@ static void echo_session_key_exit(const struct lu_context 
*ctx,
goto out_cleanup;
}
 
-   next->ld_site = &ed->ed_site->cs_lu;
+   next->ld_site = ed->ed_site;
rc = next->ld_type->ldt_ops->ldto_device_init(env, next,
next->ld_type->ldt_name,
  NULL);
@@ -741,7 +743,7 @@ static void echo_lock_release(const struct lu_env *env,
CDEBUG(D_INFO, "echo device:%p is going to be freed, next = %p\n",
   ed, next);
 
-   lu_site_purge(env, &ed->ed_site->cs_lu, -1);
+   lu_site_purge(env, ed->ed_site, -1);
 
/* check if there are objects still alive.
 * It shouldn't have any object because lu_site_purge would cleanup
@@ -754,7 +756,7 @@ static void echo_lock_release(const struct lu_env *env,
spin_unlock(&ec->ec_lock);
 
/* purge again */
-   lu_site_purge(env, &ed->ed_site->cs_lu, -1);
+   lu_site_purge(env, ed->ed_site, -1);
 
CDEBUG(D_INFO,
   "Waiting for the reference of echo object to be dropped\n");
@@ -766,7 +768,7 @@ static void echo_lock_release(const struct lu_env *env,
CERROR("echo_client still has objects at cleanup time, wait for 
1 second\n");
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(cfs_time_seconds(1));
-   lu_site_purge(env, &ed->ed_site->cs_lu, -1);
+   lu_site_purge(env, ed->ed_site, -1);
spin_lock(&ec->ec_lock);
}
spin_unlock(&ec->ec_lock);
@@ -780,7 +782,7 @@ static void echo_lock_release(const struct lu_env *env,
while (next)
next = next->ld_type->ldt_ops->ldto_device_free(env, next);
 
-   LASSERT(ed->ed_site == lu2cl_site(d->ld_site));
+   LASSERT(ed->ed_site == d->ld_site);
echo_site_fini(env, ed);
cl_device_fini(&ed->ed_cl);
kfree(ed);
-- 
1.7.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 25/29] staging: lustre: llite: Inform copytool of dataversion changes

2016-10-27 Thread James Simmons
From: Henri Doreau 

Notify copytool that a file could not be archived due to dataversion
change. This does not introduce any functional change but ensures
that errors are consistently reported in copytool logs.

Signed-off-by: Henri Doreau 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5683
Reviewed-on: http://review.whamcloud.com/14377
Reviewed-by: Jinshan Xiong 
Reviewed-by: Robert Read 
Reviewed-by: John L. Hammond 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/llite/dir.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/dir.c 
b/drivers/staging/lustre/lustre/llite/dir.c
index 64a32d5..ce05493 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -837,10 +837,10 @@ static int ll_ioc_copy_end(struct super_block *sb, struct 
hsm_copy *copy)
 * when the file will not be modified for some tunable
 * time
 */
-   /* we do not notify caller */
hpk.hpk_flags &= ~HP_FLAG_RETRY;
+   rc = -EBUSY;
/* hpk_errval must be >= 0 */
-   hpk.hpk_errval = EBUSY;
+   hpk.hpk_errval = -rc;
}
}
 
-- 
1.7.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 14/29] staging: lustre: ptlrpc: Do not resend req with allow_replay

2016-10-27 Thread James Simmons
From: wang di 

If the request is allowed to be sent during recovery,
and it is not timeout yet, then we do not need to
resend it in the final stage of recovery.

Unnecessary resend will cause the bulk request to resend the
request with different mbit, but same xid, and on the remote
server side, it will drop such request with same xid, so it
will never get the bulk in this case.

Signed-off-by: wang di 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6780
Reviewed-on: http://review.whamcloud.com/15458
Reviewed-by: Alex Zhuravlev 
Reviewed-by: Liang Zhen 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/ptlrpc/recover.c |8 +++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/recover.c 
b/drivers/staging/lustre/lustre/ptlrpc/recover.c
index 405faf0..aa96534 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/recover.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/recover.c
@@ -194,7 +194,13 @@ int ptlrpc_resend(struct obd_import *imp)
LASSERTF((long)req > PAGE_SIZE && req != LP_POISON,
 "req %p bad\n", req);
LASSERTF(req->rq_type != LI_POISON, "req %p freed\n", req);
-   if (!ptlrpc_no_resend(req))
+
+   /*
+* If the request is allowed to be sent during replay and it
+* is not timeout yet, then it does not need to be resent.
+*/
+   if (!ptlrpc_no_resend(req) &&
+   (req->rq_timedout || !req->rq_allow_replay))
ptlrpc_resend_req(req);
}
spin_unlock(&imp->imp_lock);
-- 
1.7.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 22/29] staging: lustre: llite: add LL_IOC_FUTIMES_3

2016-10-27 Thread James Simmons
From: John L. Hammond 

Add a new regular file ioctl LL_IOC_FUTIMES_3 similar to futimes() but
which allows setting of all three inode timestamps. Use this ioctl
during HSM restore to ensure that the volatile file has the same
timestamps as the file to be restored. Strengthen sanity-hsm test_24a
to check that archive, release, and restore do not change a file's
ctime. Add sanity-hsm test_24e to check that tar will succeed when it
encounters a HSM released file.

Signed-off-by: John L. Hammond 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6213
Reviewed-on: http://review.whamcloud.com/13665
Reviewed-by: Andreas Dilger 
Reviewed-by: Jinshan Xiong 
Reviewed-by: frank zago 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 .../lustre/lustre/include/lustre/lustre_user.h |   10 
 drivers/staging/lustre/lustre/llite/file.c |   45 
 drivers/staging/lustre/lustre/llite/llite_lib.c|6 ++-
 3 files changed, 59 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h 
b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
index 856e2f9..1d72b73 100644
--- a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
@@ -213,6 +213,15 @@ struct ost_id {
 #define DOSTID "%#llx:%llu"
 #define POSTID(oi) ostid_seq(oi), ostid_id(oi)
 
+struct ll_futimes_3 {
+   __u64 lfu_atime_sec;
+   __u64 lfu_atime_nsec;
+   __u64 lfu_mtime_sec;
+   __u64 lfu_mtime_nsec;
+   __u64 lfu_ctime_sec;
+   __u64 lfu_ctime_nsec;
+};
+
 /*
  * The ioctl naming rules:
  * LL_* - works on the currently opened filehandle instead of parent dir
@@ -249,6 +258,7 @@ struct ost_id {
 #define LL_IOC_PATH2FID _IOR('f', 173, long)
 #define LL_IOC_GET_CONNECT_FLAGS   _IOWR('f', 174, __u64 *)
 #define LL_IOC_GET_MDTIDX _IOR('f', 175, int)
+#define LL_IOC_FUTIMES_3   _IOWR('f', 176, struct ll_futimes_3)
 
 /* lustre_ioctl.h  177-210 */
 #define LL_IOC_HSM_STATE_GET   _IOR('f', 211, struct hsm_user_state)
diff --git a/drivers/staging/lustre/lustre/llite/file.c 
b/drivers/staging/lustre/lustre/llite/file.c
index 0ae78c7..694d920 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -1904,6 +1904,41 @@ static inline long ll_lease_type_from_fmode(fmode_t 
fmode)
   ((fmode & FMODE_WRITE) ? LL_LEASE_WRLCK : 0);
 }
 
+static int ll_file_futimes_3(struct file *file, const struct ll_futimes_3 *lfu)
+{
+   struct inode *inode = file_inode(file);
+   struct iattr ia = {
+   .ia_valid = ATTR_ATIME | ATTR_ATIME_SET |
+   ATTR_MTIME | ATTR_MTIME_SET |
+   ATTR_CTIME | ATTR_CTIME_SET,
+   .ia_atime = {
+   .tv_sec = lfu->lfu_atime_sec,
+   .tv_nsec = lfu->lfu_atime_nsec,
+   },
+   .ia_mtime = {
+   .tv_sec = lfu->lfu_mtime_sec,
+   .tv_nsec = lfu->lfu_mtime_nsec,
+   },
+   .ia_ctime = {
+   .tv_sec = lfu->lfu_ctime_sec,
+   .tv_nsec = lfu->lfu_ctime_nsec,
+   },
+   };
+   int rc;
+
+   if (!capable(CAP_SYS_ADMIN))
+   return -EPERM;
+
+   if (!S_ISREG(inode->i_mode))
+   return -EINVAL;
+
+   inode_lock(inode);
+   rc = ll_setattr_raw(file_dentry(file), &ia, false);
+   inode_unlock(inode);
+
+   return rc;
+}
+
 static long
 ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
@@ -2138,6 +2173,16 @@ static inline long ll_lease_type_from_fmode(fmode_t 
fmode)
fmode = 0;
 
return ll_lease_type_from_fmode(fmode);
+   case LL_IOC_FUTIMES_3: {
+   const struct ll_futimes_3 __user *lfu_user;
+   struct ll_futimes_3 lfu;
+
+   lfu_user = (const struct ll_futimes_3 __user *)arg;
+   if (copy_from_user(&lfu, lfu_user, sizeof(lfu)))
+   return -EFAULT;
+
+   return ll_file_futimes_3(file, &lfu);
+   }
default:
return -EINVAL;
}
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c 
b/drivers/staging/lustre/lustre/llite/llite_lib.c
index 308da06..2954aa9 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -1410,7 +1410,8 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr 
*attr, bool hsm_import)
}
 
/* We mark all of the fields "set" so MDS/OST does not re-set them */
-   if (attr->ia_valid & ATTR_CTIME) {
+   if (!(attr->ia_valid & ATTR_CTIME_SET) &&
+ 

Re: [PATCH 12/29] staging: lustre: mdc: manage number of modify RPCs in flight

2016-10-27 Thread kbuild test robot
Hi Gregoire,

[auto build test WARNING on staging/staging-testing]
[also build test WARNING on next-20161027]
[cannot apply to v4.9-rc2]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]
[Suggest to use git(>=2.9.0) format-patch --base= (or --base=auto for 
convenience) to record what (public, well-known) commit your patch series was 
built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:
https://github.com/0day-ci/linux/commits/James-Simmons/Batch-one-for-work-from-2-7-55-to-2-7-59/20161028-061814
config: openrisc-allmodconfig (attached as .config)
compiler: or32-linux-gcc (GCC) 4.5.1-or32-1.0rc1
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=openrisc 

All warnings (new ones prefixed by >>):

   drivers/staging/lustre/lustre/obdclass/genops.c: In function 
'obd_mod_rpc_stats_seq_show':
>> drivers/staging/lustre/lustre/obdclass/genops.c:1518:6: warning: format 
>> '%lu' expects type 'long unsigned int', but argument 3 has type 'time64_t'

vim +1518 drivers/staging/lustre/lustre/obdclass/genops.c

  1502  }
  1503  EXPORT_SYMBOL(obd_set_max_mod_rpcs_in_flight);
  1504  
  1505  #define pct(a, b) (b ? (a * 100) / b : 0)
  1506  
  1507  int obd_mod_rpc_stats_seq_show(struct client_obd *cli, struct seq_file 
*seq)
  1508  {
  1509  unsigned long mod_tot = 0, mod_cum;
  1510  struct timespec64 now;
  1511  int i;
  1512  
  1513  ktime_get_real_ts64(&now);
  1514  
  1515  spin_lock(&cli->cl_mod_rpcs_lock);
  1516  
  1517  seq_printf(seq, "snapshot_time: %lu.%lu (secs.usecs)\n",
> 1518 now.tv_sec, now.tv_nsec / 1000);
  1519  seq_printf(seq, "modify_RPCs_in_flight:  %hu\n",
  1520 cli->cl_mod_rpcs_in_flight);
  1521  
  1522  seq_puts(seq, "\n\t\t\tmodify\n");
  1523  seq_puts(seq, "rpcs in flightrpcs   %% cum %%\n");
  1524  
  1525  mod_tot = lprocfs_oh_sum(&cli->cl_mod_rpcs_hist);
  1526  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/3] staging: sm750fb: Refine code in set_current_gate().

2016-10-27 Thread Elise Lennion
The 'switch' statement in set_current_gate() had only two possible
scenarios, so it was replaced with an 'if' statement to make the code
shorter and easier to understand.

Signed-off-by: Elise Lennion 
---
 drivers/staging/sm750fb/ddk750_power.c | 24 
 1 file changed, 4 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_power.c 
b/drivers/staging/sm750fb/ddk750_power.c
index c9ea464..6c15b12 100644
--- a/drivers/staging/sm750fb/ddk750_power.c
+++ b/drivers/staging/sm750fb/ddk750_power.c
@@ -74,26 +74,10 @@ void set_power_mode(unsigned int powerMode)
 
 void set_current_gate(unsigned int gate)
 {
-   unsigned int gate_reg;
-   unsigned int mode;
-
-   /* Get current power mode. */
-   mode = getPowerMode();
-
-   switch (mode) {
-   case POWER_MODE_CTRL_MODE_MODE0:
-   gate_reg = MODE0_GATE;
-   break;
-
-   case POWER_MODE_CTRL_MODE_MODE1:
-   gate_reg = MODE1_GATE;
-   break;
-
-   default:
-   gate_reg = MODE0_GATE;
-   break;
-   }
-   POKE32(gate_reg, gate);
+   if (getPowerMode() == POWER_MODE_CTRL_MODE_MODE1)
+   POKE32(MODE1_GATE, gate);
+   else
+   POKE32(MODE0_GATE, gate);
 }
 
 
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/3] staging: sm750fb: Replace functions CamelCase naming with underscores.

2016-10-27 Thread Elise Lennion
Replace CamelCase function names with underscores to comply with
the standard kernel coding style.

Signed-off-by: Elise Lennion 
---
 drivers/staging/sm750fb/ddk750_chip.c|  4 ++--
 drivers/staging/sm750fb/ddk750_display.c |  2 +-
 drivers/staging/sm750fb/ddk750_hwi2c.c   |  4 ++--
 drivers/staging/sm750fb/ddk750_power.c   | 14 +++---
 drivers/staging/sm750fb/ddk750_power.h   | 10 +-
 drivers/staging/sm750fb/ddk750_swi2c.c   |  2 +-
 drivers/staging/sm750fb/sm750_hw.c   |  2 +-
 7 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_chip.c 
b/drivers/staging/sm750fb/ddk750_chip.c
index c8c14ee..14b5112 100644
--- a/drivers/staging/sm750fb/ddk750_chip.c
+++ b/drivers/staging/sm750fb/ddk750_chip.c
@@ -261,7 +261,7 @@ int ddk750_init_hw(struct initchip_param *pInitParam)
}
 
if (pInitParam->setAllEngOff == 1) {
-   enable2DEngine(0);
+   enable_2d_engine(0);
 
/* Disable Overlay, if a former application left it on */
reg = PEEK32(VIDEO_DISPLAY_CTRL);
@@ -284,7 +284,7 @@ int ddk750_init_hw(struct initchip_param *pInitParam)
POKE32(DMA_ABORT_INTERRUPT, reg);
 
/* Disable DMA Power, if a former application left it on */
-   enableDMA(0);
+   enable_dma(0);
}
 
/* We can add more initialization as needed. */
diff --git a/drivers/staging/sm750fb/ddk750_display.c 
b/drivers/staging/sm750fb/ddk750_display.c
index 0f3a875..c347803 100644
--- a/drivers/staging/sm750fb/ddk750_display.c
+++ b/drivers/staging/sm750fb/ddk750_display.c
@@ -153,5 +153,5 @@ void ddk750_setLogicalDispOut(disp_output_t output)
setDAC((output & DAC_MASK) >> DAC_OFFSET);
 
if (output & DPMS_USAGE)
-   ddk750_setDPMS((output & DPMS_MASK) >> DPMS_OFFSET);
+   ddk750_set_dpms((output & DPMS_MASK) >> DPMS_OFFSET);
 }
diff --git a/drivers/staging/sm750fb/ddk750_hwi2c.c 
b/drivers/staging/sm750fb/ddk750_hwi2c.c
index b60bedf..10439e0 100644
--- a/drivers/staging/sm750fb/ddk750_hwi2c.c
+++ b/drivers/staging/sm750fb/ddk750_hwi2c.c
@@ -24,7 +24,7 @@ unsigned char bus_speed_mode
 * Enable Hardware I2C power.
 * TODO: Check if we need to enable GPIO power?
 */
-   enableI2C(1);
+   enable_i2c(1);
 
/* Enable the I2C Controller and set the bus speed mode */
value = PEEK32(I2C_CTRL) & ~(I2C_CTRL_MODE | I2C_CTRL_EN);
@@ -45,7 +45,7 @@ void sm750_hw_i2c_close(void)
POKE32(I2C_CTRL, value);
 
/* Disable I2C Power */
-   enableI2C(0);
+   enable_i2c(0);
 
/* Set GPIO 30 & 31 back as GPIO pins */
value = PEEK32(GPIO_MUX);
diff --git a/drivers/staging/sm750fb/ddk750_power.c 
b/drivers/staging/sm750fb/ddk750_power.c
index 6c15b12..fda9280 100644
--- a/drivers/staging/sm750fb/ddk750_power.c
+++ b/drivers/staging/sm750fb/ddk750_power.c
@@ -2,7 +2,7 @@
 #include "ddk750_reg.h"
 #include "ddk750_power.h"
 
-void ddk750_setDPMS(DPMS_t state)
+void ddk750_set_dpms(DPMS_t state)
 {
unsigned int value;
 
@@ -17,7 +17,7 @@ void ddk750_setDPMS(DPMS_t state)
}
 }
 
-static unsigned int getPowerMode(void)
+static unsigned int get_power_mode(void)
 {
if (sm750_get_chip_type() == SM750LE)
return 0;
@@ -74,7 +74,7 @@ void set_power_mode(unsigned int powerMode)
 
 void set_current_gate(unsigned int gate)
 {
-   if (getPowerMode() == POWER_MODE_CTRL_MODE_MODE1)
+   if (get_power_mode() == POWER_MODE_CTRL_MODE_MODE1)
POKE32(MODE1_GATE, gate);
else
POKE32(MODE0_GATE, gate);
@@ -85,7 +85,7 @@ void set_current_gate(unsigned int gate)
 /*
  * This function enable/disable the 2D engine.
  */
-void enable2DEngine(unsigned int enable)
+void enable_2d_engine(unsigned int enable)
 {
u32 gate;
 
@@ -98,7 +98,7 @@ void enable2DEngine(unsigned int enable)
set_current_gate(gate);
 }
 
-void enableDMA(unsigned int enable)
+void enable_dma(unsigned int enable)
 {
u32 gate;
 
@@ -115,7 +115,7 @@ void enableDMA(unsigned int enable)
 /*
  * This function enable/disable the GPIO Engine
  */
-void enableGPIO(unsigned int enable)
+void enable_gpio(unsigned int enable)
 {
u32 gate;
 
@@ -132,7 +132,7 @@ void enableGPIO(unsigned int enable)
 /*
  * This function enable/disable the I2C Engine
  */
-void enableI2C(unsigned int enable)
+void enable_i2c(unsigned int enable)
 {
u32 gate;
 
diff --git a/drivers/staging/sm750fb/ddk750_power.h 
b/drivers/staging/sm750fb/ddk750_power.h
index 7b24f11..ea56026 100644
--- a/drivers/staging/sm750fb/ddk750_power.h
+++ b/drivers/staging/sm750fb/ddk750_power.h
@@ -14,29 +14,29 @@ DPMS_t;
   (PEEK32(MISC_CTRL) & ~MISC_CTRL_DAC_POWER_OFF) | (off)); \
 }
 
-void ddk750_setDPMS(DPMS_t);
+void ddk750_set_dpms(DPMS_t);
 void set_power_mode(unsigned int powerMode);
 void set_current_gate(unsigned int 

[PATCH 3/3] staging: sm750fb: Shorten local variables names.

2016-10-27 Thread Elise Lennion
Shorter names are preferred by C variables naming convention, they are
easier to write and aren't more difficult to understand.

Signed-off-by: Elise Lennion 
---
 drivers/staging/sm750fb/ddk750_power.c | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_power.c 
b/drivers/staging/sm750fb/ddk750_power.c
index fda9280..6f43740 100644
--- a/drivers/staging/sm750fb/ddk750_power.c
+++ b/drivers/staging/sm750fb/ddk750_power.c
@@ -29,26 +29,26 @@ static unsigned int get_power_mode(void)
  * SM50x can operate in one of three modes: 0, 1 or Sleep.
  * On hardware reset, power mode 0 is default.
  */
-void set_power_mode(unsigned int powerMode)
+void set_power_mode(unsigned int mode)
 {
-   unsigned int control_value = 0;
+   unsigned int ctrl = 0;
 
-   control_value = PEEK32(POWER_MODE_CTRL) & ~POWER_MODE_CTRL_MODE_MASK;
+   ctrl = PEEK32(POWER_MODE_CTRL) & ~POWER_MODE_CTRL_MODE_MASK;
 
if (sm750_get_chip_type() == SM750LE)
return;
 
-   switch (powerMode) {
+   switch (mode) {
case POWER_MODE_CTRL_MODE_MODE0:
-   control_value |= POWER_MODE_CTRL_MODE_MODE0;
+   ctrl |= POWER_MODE_CTRL_MODE_MODE0;
break;
 
case POWER_MODE_CTRL_MODE_MODE1:
-   control_value |= POWER_MODE_CTRL_MODE_MODE1;
+   ctrl |= POWER_MODE_CTRL_MODE_MODE1;
break;
 
case POWER_MODE_CTRL_MODE_SLEEP:
-   control_value |= POWER_MODE_CTRL_MODE_SLEEP;
+   ctrl |= POWER_MODE_CTRL_MODE_SLEEP;
break;
 
default:
@@ -56,20 +56,20 @@ void set_power_mode(unsigned int powerMode)
}
 
/* Set up other fields in Power Control Register */
-   if (powerMode == POWER_MODE_CTRL_MODE_SLEEP) {
-   control_value &= ~POWER_MODE_CTRL_OSC_INPUT;
+   if (mode == POWER_MODE_CTRL_MODE_SLEEP) {
+   ctrl &= ~POWER_MODE_CTRL_OSC_INPUT;
 #ifdef VALIDATION_CHIP
-   control_value &= ~POWER_MODE_CTRL_336CLK;
+   ctrl &= ~POWER_MODE_CTRL_336CLK;
 #endif
} else {
-   control_value |= POWER_MODE_CTRL_OSC_INPUT;
+   ctrl |= POWER_MODE_CTRL_OSC_INPUT;
 #ifdef VALIDATION_CHIP
-   control_value |= POWER_MODE_CTRL_336CLK;
+   ctrl |= POWER_MODE_CTRL_336CLK;
 #endif
}
 
/* Program new power mode. */
-   POKE32(POWER_MODE_CTRL, control_value);
+   POKE32(POWER_MODE_CTRL, ctrl);
 }
 
 void set_current_gate(unsigned int gate)
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3] staging : rtl8712: Free memory when kmalloc fails

2016-10-27 Thread Souptick Joarder
There are few functions where we need to free previously allocated memory
when kmalloc fails. Else it may lead to memory leakage. In  _init_cmd_priv()
and _r8712_init_xmit_priv(), in few places we are not freeing previously
allocated memory when kmalloc fails.

Signed-off-by: Souptick joarder 
---
v2:
  - Make the commit message more descriptive
v3:
  - Modified the patch description by adding space in required places

 drivers/staging/rtl8712/rtl871x_cmd.c  | 4 +++-
 drivers/staging/rtl8712/rtl871x_xmit.c | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c 
b/drivers/staging/rtl8712/rtl871x_cmd.c
index b7ee5e6..1f284ae 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -72,8 +72,10 @@ static sint _init_cmd_priv(struct cmd_priv *pcmdpriv)
((addr_t)(pcmdpriv->cmd_allocated_buf) &
(CMDBUFF_ALIGN_SZ - 1));
pcmdpriv->rsp_allocated_buf = kmalloc(MAX_RSPSZ + 4, GFP_ATOMIC);
-   if (!pcmdpriv->rsp_allocated_buf)
+   if (!pcmdpriv->rsp_allocated_buf) {
+   kfree(pcmdpriv->cmd_allocated_buf);
+   pcmdpriv->cmd_allocated_buf = NULL;
return _FAIL;
+   }
pcmdpriv->rsp_buf = pcmdpriv->rsp_allocated_buf  +  4 -
((addr_t)(pcmdpriv->rsp_allocated_buf) & 3);
pcmdpriv->cmd_issued_cnt = 0;
diff --git a/drivers/staging/rtl8712/rtl871x_xmit.c 
b/drivers/staging/rtl8712/rtl871x_xmit.c
index be38364..f335161 100644
--- a/drivers/staging/rtl8712/rtl871x_xmit.c
+++ b/drivers/staging/rtl8712/rtl871x_xmit.c
@@ -128,8 +128,10 @@ sint _r8712_init_xmit_priv(struct xmit_priv *pxmitpriv,
_init_queue(&pxmitpriv->pending_xmitbuf_queue);
pxmitpriv->pallocated_xmitbuf = kmalloc(NR_XMITBUFF * sizeof(struct 
xmit_buf) + 4,
GFP_ATOMIC);
-   if (!pxmitpriv->pallocated_xmitbuf)
+   if (!pxmitpriv->pallocated_xmitbuf) {
+   kfree(pxmitpriv->pallocated_frame_buf);
+   pxmitpriv->pallocated_frame_buf = NULL;
return _FAIL;
+   }
pxmitpriv->pxmitbuf = pxmitpriv->pallocated_xmitbuf + 4 -
  ((addr_t)(pxmitpriv->pallocated_xmitbuf) & 3);
pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmitbuf;
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [driver-core:driver-core-testing 2/6] drivers/built-in.o:undefined reference to `process_srcu'

2016-10-27 Thread Greg Kroah-Hartman
On Fri, Oct 28, 2016 at 05:48:34AM +0800, kbuild test robot wrote:
> tree:   
> https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git 
> driver-core-testing
> head:   ae17f29d0bb84a43b6c5f3e9fac0b124960c53f7
> commit: eb6b1b0ba7aa8da0b67bba65764d1258f87b924e [2/6] driver core: 
> Functional dependencies tracking support
> config: mips-allnoconfig (attached as .config)
> compiler: mips-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
> reproduce:
> wget 
> https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
>  -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> git checkout eb6b1b0ba7aa8da0b67bba65764d1258f87b924e
> # save the attached .config to linux build tree
> make.cross ARCH=mips 
> 
> All errors (new ones prefixed by >>):
> 
>drivers/built-in.o: In function `__device_link_del':
>core.c:(.text+0x3ae4): undefined reference to `call_srcu'
>drivers/built-in.o: In function `device_links_read_lock':
>(.text+0x3f98): undefined reference to `__srcu_read_lock'
>drivers/built-in.o: In function `device_links_read_unlock':
>(.text+0x3fb4): undefined reference to `__srcu_read_unlock'
> >> drivers/built-in.o:(.data+0x3a8): undefined reference to `process_srcu'

Rafael, I've dropped your series from my tree now, with the exception of
patch 1.  Can you resend the remaining ones after fixing up this issue?

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel