mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-27 03:19:35 +03:00
Illumos 6268 - zfs diff confused by moving a file to another directory
6268 zfs diff confused by moving a file to another directory Reviewed by: Matthew Ahrens <mahrens@delphix.com> Reviewed by: Justin Gibbs <gibbs@scsiguy.com> Approved by: Dan McDonald <danmcd@omniti.com> References: https://www.illumos.org/issues/6268 https://github.com/illumos/illumos-gate/commit/aab0441 Ported-by: kernelOfTruth kerneloftruth@gmail.com Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
parent
0eb21616fa
commit
616a57bea8
@ -22,6 +22,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
|
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
|
||||||
|
* Copyright 2015 Joyent, Inc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -54,15 +55,6 @@
|
|||||||
#define ZDIFF_REMOVED '-'
|
#define ZDIFF_REMOVED '-'
|
||||||
#define ZDIFF_RENAMED 'R'
|
#define ZDIFF_RENAMED 'R'
|
||||||
|
|
||||||
static boolean_t
|
|
||||||
do_name_cmp(const char *fpath, const char *tpath)
|
|
||||||
{
|
|
||||||
char *fname, *tname;
|
|
||||||
fname = strrchr(fpath, '/') + 1;
|
|
||||||
tname = strrchr(tpath, '/') + 1;
|
|
||||||
return (strcmp(fname, tname) == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef struct differ_info {
|
typedef struct differ_info {
|
||||||
zfs_handle_t *zhp;
|
zfs_handle_t *zhp;
|
||||||
char *fromsnap;
|
char *fromsnap;
|
||||||
@ -258,7 +250,6 @@ static int
|
|||||||
write_inuse_diffs_one(FILE *fp, differ_info_t *di, uint64_t dobj)
|
write_inuse_diffs_one(FILE *fp, differ_info_t *di, uint64_t dobj)
|
||||||
{
|
{
|
||||||
struct zfs_stat fsb, tsb;
|
struct zfs_stat fsb, tsb;
|
||||||
boolean_t same_name;
|
|
||||||
mode_t fmode, tmode;
|
mode_t fmode, tmode;
|
||||||
char fobjname[MAXPATHLEN], tobjname[MAXPATHLEN];
|
char fobjname[MAXPATHLEN], tobjname[MAXPATHLEN];
|
||||||
int fobjerr, tobjerr;
|
int fobjerr, tobjerr;
|
||||||
@ -319,7 +310,6 @@ write_inuse_diffs_one(FILE *fp, differ_info_t *di, uint64_t dobj)
|
|||||||
|
|
||||||
if (fmode != tmode && fsb.zs_gen == tsb.zs_gen)
|
if (fmode != tmode && fsb.zs_gen == tsb.zs_gen)
|
||||||
tsb.zs_gen++; /* Force a generational difference */
|
tsb.zs_gen++; /* Force a generational difference */
|
||||||
same_name = do_name_cmp(fobjname, tobjname);
|
|
||||||
|
|
||||||
/* Simple modification or no change */
|
/* Simple modification or no change */
|
||||||
if (fsb.zs_gen == tsb.zs_gen) {
|
if (fsb.zs_gen == tsb.zs_gen) {
|
||||||
@ -330,7 +320,7 @@ write_inuse_diffs_one(FILE *fp, differ_info_t *di, uint64_t dobj)
|
|||||||
if (change) {
|
if (change) {
|
||||||
print_link_change(fp, di, change,
|
print_link_change(fp, di, change,
|
||||||
change > 0 ? fobjname : tobjname, &tsb);
|
change > 0 ? fobjname : tobjname, &tsb);
|
||||||
} else if (same_name) {
|
} else if (strcmp(fobjname, tobjname) == 0) {
|
||||||
print_file(fp, di, ZDIFF_MODIFIED, fobjname, &tsb);
|
print_file(fp, di, ZDIFF_MODIFIED, fobjname, &tsb);
|
||||||
} else {
|
} else {
|
||||||
print_rename(fp, di, fobjname, tobjname, &tsb);
|
print_rename(fp, di, fobjname, tobjname, &tsb);
|
||||||
|
Loading…
Reference in New Issue
Block a user