From: Ralph Boehme Date: Mon, 21 Jan 2013 14:06:39 +0000 (+0100) Subject: dbd failed to convert appledouble files of symlinks X-Git-Url: https://arthur.barton.de/gitweb/?p=netatalk.git;a=commitdiff_plain;h=536285d234458f7ff8fee148c7e4a047f43ee064 dbd failed to convert appledouble files of symlinks dbd simply skipped symlinks, fix this by possibly deleting the appledouble file but still skip the CNID checks. Also remove left-over rebuild db stuff which isn't used anymore since the large dbd rewrite at 4913dbbc5b69642dacbe7302fc25d25f47e9c00c. Fixes #490. --- diff --git a/etc/cnid_dbd/cmd_dbd_scanvol.c b/etc/cnid_dbd/cmd_dbd_scanvol.c index 48deb5f0..b9fbf3e8 100644 --- a/etc/cnid_dbd/cmd_dbd_scanvol.c +++ b/etc/cnid_dbd/cmd_dbd_scanvol.c @@ -49,7 +49,6 @@ static char cwdbuf[MAXPATHLEN+1]; static struct vol *vol; -static DBD *dbd_rebuild; static dbd_flags_t dbd_flags; static char stamp[CNID_DEV_LEN]; static char *netatalk_dirs[] = { @@ -686,10 +685,8 @@ static int dbd_readdir(int volroot, cnid_t did) switch (st.st_mode & S_IFMT) { case S_IFREG: case S_IFDIR: - break; case S_IFLNK: - dbd_log(LOGDEBUG, "Ignoring symlink %s/%s", cwdbuf, ep->d_name); - continue; + break; default: dbd_log(LOGSTD, "Bad filetype: %s/%s", cwdbuf, ep->d_name); if ( ! (dbd_flags & DBD_FLAGS_SCAN)) { @@ -726,41 +723,21 @@ static int dbd_readdir(int volroot, cnid_t did) if (ADDIR_OK) adfile_ok = check_adfile(ep->d_name, &st, &name); - if (name == NULL) { - name = ep->d_name; - } else { - update_cnid(did, &st, ep->d_name, name); - } + if (!S_ISLNK(st.st_mode)) { + if (name == NULL) { + name = ep->d_name; + } else { + update_cnid(did, &st, ep->d_name, name); + } - /* Check CNIDs */ - cnid = check_cnid(name, did, &st, adfile_ok); + /* Check CNIDs */ + cnid = check_cnid(name, did, &st, adfile_ok); - /* Now add this object to our rebuild dbd */ - if (cnid && dbd_rebuild) { - static uint count = 0; - rqst.cnid = rply.cnid; - ret = dbd_rebuild_add(dbd_rebuild, &rqst, &rply); - if (dbif_txn_close(dbd_rebuild, ret) != 0) - return -1; - if (rply.result != CNID_DBD_RES_OK) { - dbd_log( LOGSTD, "Fatal error adding CNID: %u for '%s/%s' to in-memory rebuild-db", - cnid, cwdbuf, name); - return -1; - } - count++; - if (count == 10000) { - if (dbif_txn_checkpoint(dbd_rebuild, 0, 0, 0) < 0) { - dbd_log(LOGSTD, "Error checkpointing!"); - return -1; - } - count = 0; - } + /* Check EA files */ + if (vol->v_vfs_ea == AFPVOL_EA_AD) + check_eafiles(name); } - /* Check EA files */ - if (vol->v_vfs_ea == AFPVOL_EA_AD) - check_eafiles(name); - /************************************************************************** Recursion **************************************************************************/ diff --git a/libatalk/adouble/ad_conv.c b/libatalk/adouble/ad_conv.c index ff0eebcc..a9fae763 100644 --- a/libatalk/adouble/ad_conv.c +++ b/libatalk/adouble/ad_conv.c @@ -173,9 +173,12 @@ static int ad_conv_v22ea(const char *path, const struct stat *sp, const struct v become_root(); - EC_ZERO( ad_conv_v22ea_hf(path, sp, vol) ); - EC_ZERO( ad_conv_v22ea_rf(path, sp, vol) ); + if (ad_conv_v22ea_hf(path, sp, vol) != 0) + goto delete; + if (ad_conv_v22ea_rf(path, sp, vol) != 0) + goto delete; +delete: EC_NULL( adpath = ad_path(path, adflags) ); LOG(log_debug, logtype_ad,"ad_conv_v22ea_hf(\"%s\"): deleting adouble:v2 file: \"%s\"", path, fullpathname(adpath));