From 18f2ef43a479721553a989931d8c60e84c5e1cac Mon Sep 17 00:00:00 2001 From: Frank Lahm Date: Tue, 15 May 2012 13:43:08 +0200 Subject: [PATCH] Changed behaviour for TimeMachine volumes in case there's a problem talking to the CNID daemons. Previously the volume was flagged read-only and an AFP message was sent to the client. As this might result in TimeMachine assuming the backup sparse bundle is damaged, we now just switch the CNID database to an in-memory tdb without the additional stuff. --- NEWS | 5 +++++ etc/afpd/file.c | 18 +++++++----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/NEWS b/NEWS index 68da4aa2..cf67388f 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,11 @@ Changes in 2.2.3 * UPD: afpd: Ensure our umask is not altered by eg pam_umask * UPD: afpd: Use GSS_C_NO_NAME as server principal when Kerberos options -fqdn and -krb5service are not set, from Jamie Gilbertson +* UPD: afpd: Changed behaviour for TimeMachine volumes in case there's a problem + talking to the CNID daemons. Previously the volume was flagged read-only + and an AFP message was sent to the client. As this might result in + TimeMachine assuming the backup sparse bundle is damaged, we now just + switch the CNID database to an in-memory tdb without the additional stuff. * FIX: afpd: sendfile() on FreeBSD was broken, courtesy of Denis Ahrens * FIX: afpd: Dont use searchdb when doing partial name search * FIX: afpd: Fix a possible bug handling disconnected sessions, diff --git a/etc/afpd/file.c b/etc/afpd/file.c index 36798904..efc002bc 100644 --- a/etc/afpd/file.c +++ b/etc/afpd/file.c @@ -264,21 +264,17 @@ restart: vol->v_path); vol->v_cdb = cnid_open(vol->v_path, vol->v_umask, "tdb", flags, NULL, NULL); if (vol->v_cdb) { - /* deactivate cnid caching/storing in AppleDouble files and set ro mode*/ vol->v_flags &= ~AFPVOL_CACHE; - vol->v_flags |= AFPVOL_RO; -#ifdef SERVERTEXT - /* kill ourself with SIGUSR2 aka msg pending */ - setmessage("Something wrong with the volume's CNID DB, using temporary CNID DB instead." - "Check server messages for details. Switching to read-only mode."); - kill(getpid(), SIGUSR2); -#endif - goto restart; /* not try again with the temp CNID db */ + if (!(vol->v_flags & AFPVOL_TM)) { + vol->v_flags |= AFPVOL_RO; + setmessage("Something wrong with the volume's CNID DB, using temporary CNID DB instead." + "Check server messages for details. Switching to read-only mode."); + kill(getpid(), SIGUSR2); + } + goto restart; /* now try again with the temp CNID db */ } else { -#ifdef SERVERTEXT setmessage("Something wrong with the volume's CNID DB, using temporary CNID DB failed too!" "Check server messages for details, can't recover from this state!"); -#endif } } afp_errno = AFPERR_MISC; -- 2.39.2