xfs
[Top] [All Lists]

Re: [PATCH v10 10/11] quota: Add proper versioning support to fs_quota_s

To: Chandra Seetharaman <sekharan@xxxxxxxxxx>
Subject: Re: [PATCH v10 10/11] quota: Add proper versioning support to fs_quota_stat
From: Jan Kara <jack@xxxxxxx>
Date: Wed, 10 Jul 2013 23:54:51 +0200
Cc: Jan Kara <jack@xxxxxxx>, Ben Myers <bpm@xxxxxxx>, swhiteho@xxxxxxxxxx, xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1373489390.6020.30.camel@xxxxxxxxxxxxxxxxxx>
References: <1372371914-11370-1-git-send-email-sekharan@xxxxxxxxxx> <1372371914-11370-11-git-send-email-sekharan@xxxxxxxxxx> <20130710155538.GY20932@xxxxxxx> <20130710162602.GB32444@xxxxxxxxxxxxx> <1373489390.6020.30.camel@xxxxxxxxxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Wed 10-07-13 15:49:50, Chandra Seetharaman wrote:
> On Wed, 2013-07-10 at 18:26 +0200, Jan Kara wrote:
> > On Wed 10-07-13 10:55:38, Ben Myers wrote:
> > > Hey Chandra,
> 
> <snip>
> 
> > > > diff --git a/fs/quota/quota.c b/fs/quota/quota.c
> > > > index c7314f1..ae6526e 100644
> > > > --- a/fs/quota/quota.c
> > > > +++ b/fs/quota/quota.c
> > > > @@ -207,12 +207,57 @@ static int quota_setxstate(struct super_block 
> > > > *sb, int cmd, void __user *addr)
> > > >  static int quota_getxstate(struct super_block *sb, void __user *addr)
> > > >  {
> > > >         struct fs_quota_stat fqs;
> > > > -       int ret;
> > > > +       struct fs_quota_stat_v1 fqs_v1;
> > > > +       int ret, size;
> > > > +       void *fqsp;
> > > >  
> > > >         if (!sb->s_qcop->get_xstate)
> > > >                 return -ENOSYS;
> > > > +
> > > > +       memset(&fqs, 0, sizeof(struct fs_quota_stat));
> > > > +       if (copy_from_user(&fqs, addr, 1)) /* just get the version */
> > > > +               return -EFAULT;
> > > > +
> > > > +       switch (fqs.qs_version) {
> > > > +       case FS_QSTAT_VERSION_2:
> > > > +               size = FS_QSTAT_V2_SIZE;
> > > > +               break;
> > > > +       default:
> > > > +               fqs.qs_version = FS_QSTAT_VERSION;
> > > > +               /* fallthrough */
> > > > +       case FS_QSTAT_VERSION:
> > > > +               size = FS_QSTAT_V1_SIZE;
> > > > +               break;
> > > > +       }
> >   Guys, you cannot really do this. If anyone is using getxstate() with
> > uninitialized buffer (which is fine so far), you cannot suddently start to
> > rely on the contents of qs_version field. That's ABI (and even API)
> > breakage.
> 
> Agree, it is a API breakage.
> 
> Will fix it by adding a new quotactl value as you suggest. 
> Does 
> 
> #define Q_XGETQSTAT2     XQM_CMD(8)
> 
> sound good ?
  Ben's Q_XGETQSTATV name looked a bit better to me but I don't really
care. Whatever works for you...

                                                                Honza

-- 
Jan Kara <jack@xxxxxxx>
SUSE Labs, CR

<Prev in Thread] Current Thread [Next in Thread>