| To: | linux-xfs@xxxxxxxxxxx, Dean Roehrich <roehrich@xxxxxxx> |
|---|---|
| Subject: | [DMAPI] code error in dm_ip_to_handle() |
| From: | Aurelien Degremont - Stagiaire <degremont@xxxxxxxxxxx> |
| Date: | Wed, 11 May 2005 18:20:18 +0200 |
| Sender: | linux-xfs-bounce@xxxxxxxxxxx |
| User-agent: | Mozilla/5.0 (X11; U; Linux i686; fr-FR; rv:1.2.1) Gecko/20030225 |
Hello, I'm still working on DMAPI code and I found a problem in dm_ip_to_handle() function. In fact, the problem is not specific to this function, I just found it here. To sum up, I found, in the XFS+DMAPI code, along all the different calls, you successively cast some structures and recopy data without verifying their content. With XFS, all is ok because 2 errors fix each others, but, when i try adding dmapi support to ext3, the problem appears. In order to create a dmapi handle, you must call dm_ip_to_handle(). This function will fill a dm_handle_t structure. The data recopied came from a dm_fsfid structure which do not have the same fields. ex: memcpy( &[DM_HANDLE_T], &[DM_FSID_T], ...) This copy the content of the len field without errors. **But the first byte of the fid_data buffer will be recopied in the padding field (dm_fid_pad) of the dm_fid structure !** (which is not what is expected) When DMAPI will try to extract the inode number, it will be wrong ! This code works correctly with XFS because XFS uses the same kind of structure as DMAPI, and so, when the datas are copied, the padding is ok. XFS will copied the data from : xfs_fid2_t --> fid_t -//pad error//-> dm_fsfid_t -//pad error//-> dm_fid_t Their 2 errors with byte alignement when data are cast and copied, but the first is the opposite of the second, so the data are correct at the end. This is not true when you correctly fill the dm_fsfid_t structure :) ________________________________________________________ #define MAXDMFSFIDSZ 46 typedef struct dm_fsfid {
__u16 fid_len; /* length of data in bytes */
unsigned char fid_data[MAXDMFSFIDSZ]; /* data (fid_len worth) */
} dm_fsfid_t;struct dm_fid {
__u16 dm_fid_len; /* length of remainder */
__u16 dm_fid_pad;
__u32 dm_fid_gen; /* generation number */
__u64 dm_fid_ino; /* 64 bits inode number */
};
typedef struct dm_fid dm_fid_t;
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | RE: Every new file goes into a new ag, Bub Thomas |
|---|---|
| Next by Date: | Re: Every new file goes into a new ag, Eric Sandeen |
| Previous by Thread: | Every new file goes into a new ag, Bub Thomas |
| Next by Thread: | Re: [DMAPI] code error in dm_ip_to_handle(), Dean Roehrich |
| Indexes: | [Date] [Thread] [Top] [All Lists] |