On Wed, Sep 08, 2010 at 05:21:45PM -0700, Steve Gonczi wrote:
> Hello,
> 
> Just looking at a piece of code in dmu_tx.c and have one question:
> 
> in dmu_tx_t *
> dmu_tx_create_dd(dsl_dir_t *dd)
> {
>       dmu_tx_t *tx = kmem_zalloc(sizeof (dmu_tx_t), KM_SLEEP);
>       tx->tx_dir = dd;
>       if (dd)
>               tx->tx_pool = dd->dd_pool;
> 
> According to this, the tx_pool may remain un-initialized, if dd==null.
> 
> in dmu_tx_count_free() the tx_pool is de-referenced without checking.
> 
> spa_t *spa  = txh->txh_tx->tx_pool->dp_spa;
>      
> Could the spa here be derived from the dnode's object set instead?
> e.g.:
> 
> spa_t *spa  = dn->dn_objset->os_spa; 
> 
> TIA for any insights.

I think the only place dd=NULL is passed is dmu_tx_create_assigned(),
but tx_pool is initialized in there:

        dmu_tx_t *
        dmu_tx_create_assigned(struct dsl_pool *dp, uint64_t txg)
        {
                dmu_tx_t *tx = dmu_tx_create_dd(NULL);

                ASSERT3U(txg, <=, dp->dp_tx.tx_open_txg);
                tx->tx_pool = dp;
        [...]

-- 
Pawel Jakub Dawidek                       http://www.wheelsystems.com
[email protected]                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!

Attachment: pgpn2vh8eLasr.pgp
Description: PGP signature

_______________________________________________
zfs-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/zfs-code

Reply via email to