From: Andrew Deason Date: Thu, 13 Dec 2018 18:25:32 +0000 (-0600) Subject: afs: Reword "cache is full" messages X-Git-Tag: upstream/1.8.3^2~13 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=05ceb67a574a8e263ce8f6738e0bf4495284f6fc;p=packages%2Fo%2Fopenafs.git afs: Reword "cache is full" messages Currently, there are multiple different areas in the code that log a message that look like this, when we encounter an ENOSPC error when writing to the cache: *** Cache partition is FULL - Decrease cachesize!!! *** The message is a bit unclear, and doesn't even mention AFS at all. Reword the message to try to explain a little more what's happening. Also, since we log the same message in several different places, move them all to a common function, called afs_WarnENOSPC, so we only need to change the message in one place. Reviewed-on: https://gerrit.openafs.org/13410 Reviewed-by: Benjamin Kaduk Tested-by: BuildBot (cherry picked from commit d9d9571785dabc5c311111b1263fe0881b0ccda5) Change-Id: I8e958f2896f5d4503d3a153b52720e8ba3025261 Reviewed-on: https://gerrit.openafs.org/13417 Tested-by: BuildBot Reviewed-by: Michael Meffie Reviewed-by: Marcio Brito Barbosa Reviewed-by: Cheyenne Wills Reviewed-by: Andrew Deason Reviewed-by: Stephan Wiesand --- diff --git a/src/afs/AIX/osi_file.c b/src/afs/AIX/osi_file.c index 4bd33711e..d3b66f569 100644 --- a/src/afs/AIX/osi_file.c +++ b/src/afs/AIX/osi_file.c @@ -240,8 +240,7 @@ afs_osi_Write(struct osi_file *afile, afs_int32 offset, void *aptr, afs_Trace3(afs_iclSetp, CM_TRACE_WRITEFAILED, ICL_TYPE_INT32, asize, ICL_TYPE_INT32, resid, ICL_TYPE_INT32, code); if (code == ENOSPC) - afs_warnuser - ("\n\n\n*** Cache partition is FULL - Decrease cachesize!!! ***\n\n"); + afs_WarnENOSPC(); setuerror(code); if (code > 0) { code = -code; diff --git a/src/afs/HPUX/osi_file.c b/src/afs/HPUX/osi_file.c index a562fd46d..529f0fa11 100644 --- a/src/afs/HPUX/osi_file.c +++ b/src/afs/HPUX/osi_file.c @@ -207,8 +207,7 @@ afs_osi_Write(struct osi_file *afile, afs_int32 offset, void *aptr, afile->offset += code; } else { if (code == ENOSPC) - afs_warnuser - ("\n\n\n*** Cache partition is FULL - Decrease cachesize!!! ***\n\n"); + afs_WarnENOSPC(); setuerror(code); if (code > 0) { code = -code; diff --git a/src/afs/IRIX/osi_file.c b/src/afs/IRIX/osi_file.c index 92a366cc8..92bbf4c5f 100644 --- a/src/afs/IRIX/osi_file.c +++ b/src/afs/IRIX/osi_file.c @@ -191,8 +191,7 @@ afs_osi_Write(struct osi_file *afile, afs_int32 offset, void *aptr, afile->offset += code; } else { if (code == ENOSPC) - afs_warnuser - ("\n\n\n*** Cache partition is FULL - Decrease cachesize!!! ***\n\n"); + afs_WarnENOSPC(); if (code > 0) { code = -code; } diff --git a/src/afs/LINUX/osi_file.c b/src/afs/LINUX/osi_file.c index fd68b16b3..a9693cb6b 100644 --- a/src/afs/LINUX/osi_file.c +++ b/src/afs/LINUX/osi_file.c @@ -299,8 +299,7 @@ afs_osi_Write(struct osi_file *afile, afs_int32 offset, void *aptr, afile->offset += code; } else { if (code == ENOSPC) - afs_warnuser - ("\n\n\n*** Cache partition is FULL - Decrease cachesize!!! ***\n\n"); + afs_WarnENOSPC(); if (code > 0) { code = -code; } diff --git a/src/afs/VNOPS/afs_vnop_write.c b/src/afs/VNOPS/afs_vnop_write.c index c7c56dc15..5372af664 100644 --- a/src/afs/VNOPS/afs_vnop_write.c +++ b/src/afs/VNOPS/afs_vnop_write.c @@ -130,8 +130,7 @@ afs_UFSWriteUIO(struct vcache *avc, afs_dcache_id_t *inode, struct uio *tuiop) # endif AFS_GLOCK(); if (code == ENOSPC) - afs_warnuser - ("\n\n\n*** Cache partition is full - decrease cachesize!!! ***\n\n\n"); + afs_WarnENOSPC(); #elif defined(AFS_SGI_ENV) AFS_GUNLOCK(); avc->f.states |= CWritingUFS; diff --git a/src/afs/afs_prototypes.h b/src/afs/afs_prototypes.h index c911e84b3..3e2b0b11e 100644 --- a/src/afs/afs_prototypes.h +++ b/src/afs/afs_prototypes.h @@ -1045,6 +1045,7 @@ extern void afs_warnuser(char *fmt, ...) extern void afs_warnall(char *fmt, ...) AFS_ATTRIBUTE_FORMAT(__printf__, 1, 2); #endif +extern void afs_WarnENOSPC(void); /* afs_vcache.c */ extern int VCHash(struct VenusFid *fid); diff --git a/src/afs/afs_warn.c b/src/afs/afs_warn.c index 17d3c89be..ba0b757ac 100644 --- a/src/afs/afs_warn.c +++ b/src/afs/afs_warn.c @@ -254,3 +254,18 @@ afs_warnall(char *fmt, ...) # endif /* AFS_LINUX20_ENV */ } #endif /* AFS_AIX_ENV */ + +/* + * Log a warning when we encounter an ENOSPC error when writing to the cache + * partition. We should not normally encounter ENOSPC errors, since we limit + * our space usage according to the client config, which should be configured + * such that we never run out of space. + */ +void +afs_WarnENOSPC(void) +{ + afs_warnuser("afs: Cache partition is FULL! This should not happen, and " + "can result in errors in userspace applications. To avoid " + "this, reduce the configured cache size so we do not run out " + "of space.\n"); +}