Re: [PATCH 4/6] shmem: prepare shmem quota infrastructure

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

 



Hi Carlos!

On Wed 12-04-23 11:44:32, Carlos Maiolino wrote:
> > > > +static int shmem_release_dquot(struct dquot *dquot)
> > > > +{
> > > > +	struct mem_dqinfo *info = sb_dqinfo(dquot->dq_sb, dquot->dq_id.type);
> > > > +	struct rb_node *node = ((struct rb_root *)info->dqi_priv)->rb_node;
> > > > +	qid_t id = from_kqid(&init_user_ns, dquot->dq_id);
> > > > +	struct quota_info *dqopt = sb_dqopt(dquot->dq_sb);
> > > > +	struct quota_id *entry = NULL;
> > > > +
> > > > +	mutex_lock(&dquot->dq_lock);
> > > > +	/* Check whether we are not racing with some other dqget() */
> > > > +	if (dquot_is_busy(dquot))
> > > > +		goto out_dqlock;
> > > > +
> > > > +	down_write(&dqopt->dqio_sem);
> > > > +	while (node) {
> > > > +		entry = rb_entry(node, struct quota_id, node);
> > > > +
> > > > +		if (id < entry->id)
> > > > +			node = node->rb_left;
> > > > +		else if (id > entry->id)
> > > > +			node = node->rb_right;
> > > > +		else
> > > > +			goto found;
> > > > +	}
> > > > +
> > > > +	up_write(&dqopt->dqio_sem);
> > > > +	mutex_unlock(&dquot->dq_lock);
> > > 
> > > We should report some kind of error here, shouldn't we? We do expect to
> > > have the quota_id allocated from shmem_acquire_dquot() and we will be
> > > possibly loosing set limits here.
> > > 
> 
> I've been looking into this today, and I'm not sure if there is any error we
> should be reporting here, as there isn't anything to really go wrong here. I was
> comparing it with other filesystems, and most of them uses dquot_release()
> return value, as a return value for .release_dquot. And on such cases, the error
> could be other than zero, if something failed while writing the dquot to disk.
> In the case here, we just write to the RB tree in memory, and it has already
> been allocated, so, I don't think there is any error we could be returning here.
> Does it sound right to you?

My point is that it should never happen that we don't find the entry in the
rbtree in shmem_release_dquot(). So we should rather WARN_ON_ONCE() and
bail or something like that, rather then silently return success. Not a big
deal but for initial debugging it might be useful.

								Honza
-- 
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux