@@ -206,3 +206,53 @@ the same permissions, metadata, and ACLs. Support for copying metadata comes
206206from
207207.Xr copyfile 3
208208.
209+ .Pp
210+ .Nm
211+ shouldn't be used on directories or files where files are actively being
212+ modified. In it's current implementation
213+ .Nm
214+ doesn't lock any files which causes several race conditions if underlying
215+ files are being modified. If a file acting as a clone source or target is
216+ modified between any of the following events, a file may be replaced by
217+ something that resembles it's previous state.
218+ .Pp
219+ .Nm
220+ operates by following this order of operations:
221+ .Bl -enum -offset indent
222+ .It
223+ File metadata retrieval and comparison to previously seen files
224+ .It
225+ Creation of a clone from a source
226+ .It
227+ Application of file metadata from the target
228+ .It
229+ Replacing the target with the clone
230+ .El
231+ .Pp
232+ For example, if file
233+ .Li a
234+ is seen and later file
235+ .Li b
236+ is found to be a match,
237+ .Li a
238+ may be changed, causing
239+ .Li b
240+ to be cloned to its new content. Likewise, file
241+ .Li b
242+ may be changed and then overwritten by a clone with it's previous content.
243+ .Pp
244+ It may be reasonable for future versions to include additional checks and locks
245+ to ensure modifications are detected prior to clone replacement.
246+ .Ss Block Corruption Risk
247+ APFS cloning deduplicates storage by making all instances of a file reference the
248+ same underlying blocks.
249+ .Em If even one of those blocks becomes corrupted, all cloned instances are
250+ .Em affected.
251+ This is not a problem with
252+ .Nm
253+ or something that
254+ .Nm
255+ can prevent, but is a fact of any filesystem. Reducing the number of copies in a
256+ single volume reduces one level of redundancy. This may pose a risk for unique or
257+ irreplaceable files. It is always a good idea to maintain backups on different
258+ logical volumes of any files, including ones that may be deduplicated.
0 commit comments